jquery - each / click function not working - Stack Overflow You can bind all buttons with a click event...

Please Visit: http://ift.tt/1ajReyV



jquery - each / click function not working - Stack Overflow



You can bind all buttons with a click event like this, there is no need to loop through them

$(function(){

$("button").click(function() {

alert($(this).attr("value"));

});

});

But a more precise selector might be:

$(function(){

$("button[id^='button-'").click(function() {

alert($(this).attr("value"));

});

});

http://ift.tt/RzCyZR

http://ift.tt/RzCyZT



jquery - each / click function not working - Stack Overflow







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/RzCBov

via LifeLong Community

No comments:

Post a Comment