Reputation: 2341
I am trying to add some functionality to my posts/new page when it loads, using jQuery. Is it possible to specifically listen to the jQuery page load event for any particular page?
Upvotes: 2
Views: 6389
Reputation: 69905
Try this
if($("#elementId").length > 0){
$(document).ready(function(){
});
}
You can also use it is same as ready method.
$(function(){
});
Upvotes: 5
Reputation: 71918
Yes:
$(document).ready(function(){
// Your code here
});
OR simply:
$(function(){
// Your code here
});
Upvotes: 1