jquery binding click event to multiple buttons -
i have 3 buttons b1, b2, b3. how bind click on 3 buttons. var b1 = $("#b1"); var b2 = $("#b2");
$(b1,b2).bind("click", function(){});
jsfiddle.net/xqpaq/
you can use .add()
b1.add(b2).add(b3).click(function(){ })
demo: fiddle
or use multiple selector
$('#b1, #b2, #b3').click(function(){ })
demo: fiddle
Comments
Post a Comment