So right now I have a bunch of jQuery code in a javascript file that I
include on every page. I'd like to separate out the jQuery calls a bit so
that only the ones relevant to each page are called. I think all the work
of looking up non-existent selectors must be slowing our site down.
Is this a good way of doing it or is there some better/more widely used way?
if (window.jQuery) {
$(document).ready(function() {
// common functions, all pages
$(".spellcheck").spellcheck();
...
// product page functions
$("body.productPage").each(function() {
$("#merchantOffers tbody tr").offer();
$("#questionInput").keypress(function(event) {...});
...
});
// category page functions
$("body.categoryPage").each(function() {
...
});
});
}
--
View this message in context:
http://www.nabble.com/Reducing-unnecessary-selector-lookups-tf3195906.html#a8873790
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/