I am using jQuery 1.8 and have been getting this error on some pages when I use the .on() function. Other pages, seemingly doing the exact same thing -- attaching triggers to dynamically created elements, that I use do not generate this error:
Uncaught TypeError: Object #<Object> has no method 'on'
JS:
$(document).ready(function(){
$(document).on("click","button.pagebutton",function() {
$("div#pagesforreview").hide();
jsD=Date();
jsP=$(this).html();
$("div#externpage").load("prexternpage.php",{d:jsD,p:jsP},function() {
$("div#externpage").show();
$("div#pageactions").show();
jsNc=1;
$("div#pagecomments").load("praddcomment.php",{d:jsD,nc:jsNc},function() {
$("div#pagecomments").show();
});
});
});
});
All dynamically generated 'pagebutton' buttons, don't trigger. And the error shows up. If I use the .live() method that is deprecated, no problems. But I prefer to use the proper new 1.8 non-deprecated method, if possible?