I’m writing a simple code using jQuery, in which I need to call a function for a series of selectors and eliminate some functions being called for a particular selector, for example
$('#id1, #id2, #id3').click(function() {
function1();
function2();
function3();
// rest of my code
});
I don’t wanna call some functions for a particular selector and for a particular reason, say I want to call all the functions when I perform click event on selectors like id1 and id2 and want to eliminate function2() being called when I perform a click event on id3
Thanks for reading
You can check the
event targetwithin your click event handler.For instance: