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 105
eventos e funções jQuery
Ímãs de geladeira do jQuery - Solução
Veja se você consegue arrumar os ímãs de geladeira para mover o código
que controla o código de desconto em sua própria função nomeada, chamada
checkForCode, e use-a como manipuladora para o evento click nas caixas.
)
Você não precisou
desses ímãs.
append
"+my_num+"
(
Declaração da
nossa função
$(document).ready(function() {
$(".guess_box").click( checkForCode );
function
checkForCode
()
{
var my_num = Math.floor((Math.random()*5) + 5);
var
discount = "<p>Your Discount is "+my_num+"%</p>";
$(this).append(
discount
);
$(".guess_box").each( function(){
$(this).unbind('
click
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