Christos Maris Christos Maris - 1 year ago 67
HTML Question

jQuery not running locally

I have the following links declared inside the head tag:

<script type="text/javascript" src="javascript/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="javascript/scripts.js"></script>

And the following code inside the scripts file:

$("#person").hover(function() {
// trigger the mouseover event
$("#person-text span").addClass("important-info");
}, function() {
// trigger the mouseout event
$("#person-text span").removeClass("important-info");

console.log( "ready!" );

I have also tried adding the jQuery library through Google and Microsoft CDNs, but it didn't work as well.

Here is a screenshot from the console errors:
enter image description here

Answer Source

I got simile type of problem some days Earlier . I moved the custom script tag at the end of the HTML page . Then the code worked .

<script type="text/javascript" src="javascript/scripts.js"></script>

Move this line to the End of your Html page , that May work . It happens for $(document).ready() function .