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.
$("#package1Pdf, #package2Pdf, #package3Pdf, #package4Pdf").click()
– CountertypeAug 5 '09
and it clearly need revision with current browser standards. – Ornis