Multiple Selectors doing the same thing in Jquery
I have this:
$('.Gallery a').click(function(event) {
event.preventDefault();
window.open ($(this).attr('href'),"Gallery","menubar=1,resizable=1,width=500,height=600");
});
basically I want it to also happenin when $('.popup a') is also clicked, how do you开发者_如何学Python have multiple click events do the same thing with different CSS classes. I hope that makes sense.
You can put two things in the same selector:
$('.Gallery a, .popup a').click(function(event) {
event.preventDefault();
window.open ($(this).attr('href'),"Gallery","menubar=1,resizable=1,width=500,height=600");
});
Use multiple selectors , CSS style:
$('.Gallery a, .popup a').click(function(event) {
event.preventDefault();
window.open ($(this).attr('href'),"Gallery","menubar=1,resizable=1,width=500,height=600");
});
精彩评论