local jQuery not working?
-
Looked around for a bit and could not find an answer. Maybe I’m using bad keywords.
I have installed wordpress and have the default Twenty Fifteen theme activated.
This is a new install and I have changed nothing to the files.
When I check the Sources tab in Chrome Developers tool, it shows jQuery is being loaded from:
wp-includes/js/jquery/jquery.js?ver=1.11.1If I check the page source I can clearly see in the head jquery is being loaded.
<script type='text/javascript' src='http://yourdomain.com/wp-includes/js/jquery/jquery.js?ver=1.11.1'></script> <script type='text/javascript' src='http://yourdomain.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>So to test whether or not jQuery commands are working or not I put a:
<script> $( document ).ready(function() { alert("hello"); }); </script>At the end of the footer.php file.
And it does NOT work. If i strip out the jquery $( document ).ready(function() { … }); stuff then the alert pops up.
If i include jQuery via CDN in the head section (header.php), then the jquery
$( document ).ready(function() { ... });does work.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
(I know you have to use enque and register in fucntions.php to properly load JS)So my question is what is the wp-includes/js/jquery/jquery.js?ver=1.11.1 file all about? Why is it being loaded if it doesn’t even execute basic jquery?
The topic ‘local jQuery not working?’ is closed to new replies.