how to use jQuery to handle specific types of html controls -


creating click event input easy

$('input').click(function () {                 alert('adsf');         }); 

but how can selective previous code works on type checkbox or of type button, rather using generic 'input' selector?

you can use built-in selectors :checkbox , :button find these elements easily.

$('input:checkbox').click(function () {     alert('checkbox'); });  $('input:button').click(function () {     alert('button'); }); 

there's :radio, :submit, :text, , :input selectors, among others


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -