Skip to Main Content
Use A Cabeça jQuery
book

Use A Cabeça jQuery

by Ryan Benedetti, Ronan Cranley
June 2013
Beginner to intermediate content levelBeginner to intermediate
537 pages
17h 42m
Portuguese (Portugal, Brazil)
Alta Books
Content preview from Use A Cabeça jQuery
você está aqui 65
seletores e métodos
Coloque $(this) para funcionar
Vejamos se $(this) pode nos ajudar a resolver nosso
problema. Atualize seu código para usar $(this), como
aparece abaixo em negrito:
Abra a página em seu navegador favorito para garantir que tudo esteja funcionando.
Preste atenção especialmente ao alerta, para garantir que obtemos a variável
discount certa. Certifique-se de clicar várias vezes para verificar se o número
aleatório concatenado na variável discount também funciona.
<script type="text/javascript">
$(document).ready(function() {
$(".guess_box").click( function() {
var discount = Math.floor((Math.random()*5) + 5);
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

USE A CABEÇA! PROGRAMAÇÃO JAVASCRIPT

USE A CABEÇA! PROGRAMAÇÃO JAVASCRIPT

Eric Freeman, Elisabeth Robson
Use a Cabeça! HTML e CSS

Use a Cabeça! HTML e CSS

Elisabeth Robson, Eric Freeman
Use A Cabeça! Programação Em HTML5

Use A Cabeça! Programação Em HTML5

Eric Freeman, Elisabeth Robson

Publisher Resources

ISBN: 9788576087571