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 jQue开发者_如何学编程ry page load event for any particular page?
Try this
if($("#elementId").length > 0){
$(document).ready(function(){
});
}
You can also use it is same as ready method.
$(function(){
});
Yes:
$(document).ready(function(){
// Your code here
});
OR simply:
$(function(){
// Your code here
});
精彩评论