How to Fix Null Error on Document Ready in Jquery
I'm working on a script that uses jquery and it's working normally on a simple page that I made. However when I create a master page...
https://www.czetsuyatech.com/2011/02/jquery-fix-null-error-document-ready.html
I'm working on a script that uses jquery and it's working normally on a simple page that I made. However when I create a master page in c# and put the jquery code in the page that extends the master page I get this error:
$("#controlId") is null error
$("#controlId") is null error
My javascript structure inside the page: <script language="javascript" type="text/javascript"> $(document).ready( function() { alert($("#controlId")); //this will return null } ); </script> //solution, get the no conflict version <script language="javascript" type="text/javascript"> var $j = jQuery.noConflict(); $j(document).ready( function() { alert($j("#controlId")); //object is properly initialized } ); </script>
Post a Comment