JQuery class selector vs id selector
I have 7 different buttons that all perform the same javascript function on click. should i use class selector or id selector. $("input.printing").on("click", function(event) { printPdf(event); }); or $("#package1Pdf").click(function(event) { printPdf(event); }); $("#package2Pdf").click(function(event) { printPdf(event); }); $("#package3Pdf").click(function(event) { printPdf(event); }); $("#package4Pdf").click(function(event) { printPdf(event); }); What are the advantage and disadvantage of each? Which is more preferred. BinaryTox1n You can use an ID filter without multiple selectors: $('[id^=