var $obj1 = $('a#one'); var $obj2 = $('a#two'); var $obj3 = $('a#three'); // Assume $('a#one, a#two, a#three') wasn't an option. How do I assign one (same) event handler e.g. click() to those three jQuery objects? Essentially, I am looking for a more efficient way of doing:
$obj1.click(function() { /* Code A */ }); $obj2.click(function() { /* Code A */ }); $obj3.click(function() { /* Code A */ });
$('a.codeA').click(function() { /* Code A */ });