i have two different divs (code was simplified, this is not the actual code.)
<div id="test"></div>
<div id="funt"></div>
what i want is, to attach the same click event to #funt
:
something like:
$('#test').click(function() {
DoWork();
});
$('#funt).click(function() {
DoWork();
});
function DoWork(){
alert('yes');
}
but isn't there a way to define multiple div's the same click event?
lets say ( yes, i know this does not work! )
($('#test'),('#funt')).click(function(){alert('yes')});
Simply:
$("#test, #funt").click(DoWork);
See Multiple Selector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With