Julia Julia - 25 days ago 5
HTML Question

HTML Fails to Reference JavaScript File

In the

head
of my document, I have two script references:

This is my html code

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
<script src='Newproject\Success.js'></script>


In my
Success.js
file, I have the following jQuery code:

$(document).ready(function(){
$('div').hover(function(){
$(this).addClass('hover')
},
function(){
$(this).removeClass('hover')
)};
)};


Despite that I have referenced
Success.js
in my HTML file, the code does not execute.

Answer

Change )} to }):

$(document).ready(function(){
    $('div').hover(
        function(){
            $(this).addClass('hover')
        },
        function(){
            $(this).removeClass('hover')
        }
    ) // it is }) indeed
});