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
Post a Comment