Rudi Kershaw
Rudi Kershaw

Reputation: 12972

ASP page not running JavaScript/JQuery

I am trying to add some JavaScript/JQuery into an ASP page made by my predecessor at work, but for some reason it is not running at all. When I check the script console in IE dev tools, it says "SCRIPT1010: Expected identifier" on the fifth JavaScript line below (not including the tags), but I can't see what the issue is.

<script type="text/javascript">
$(document).ready(function(){
    $("#dynamicregisterbutton").hover(mEnter, mLeave);      
});
function mEnter(){
    $.("#dynamicloginbutton").stop(false,true).hide(200);
    $.("#dynamicregisterbutton").stop(false,true).animate({width:'220px'},{duration:300, queue:false});
    $.("#dynamicregisterbutton").stop(false,true).animate({height:'80px'},{duration:300, queue:false}); 
}
function mLeave(){
    $.("#dynamicloginbutton").stop(false,true).show(200);
    $.("#dynamicregisterbutton").stop(false,true).animate({width:"100px"},{duration:300, queue:false});
    $.("#dynamicregisterbutton").stop(false,true).animate({height:"32px"},{duration:300, queue:false}); 
}
</script>

I am using the below script tag to link to the JQuery library;

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

As far as I can tell from reading around there shouldn't be any issue running JavaScript inside of ASP files, and I am sure I have done it at some point before. Is there something I am missing?

Upvotes: 0

Views: 129

Answers (2)

Rory McCrossan
Rory McCrossan

Reputation: 337560

You don't need the . character in the selectors. Try this:

function mEnter(){
    $("#dynamicloginbutton").stop(false,true).hide(200);
    $("#dynamicregisterbutton").stop(false,true).animate({width:'220px'},{duration:300, queue:false});
    $("#dynamicregisterbutton").stop(false,true).animate({height:'80px'},{duration:300, queue:false}); 
}
function mLeave(){
    $("#dynamicloginbutton").stop(false,true).show(200);
    $("#dynamicregisterbutton").stop(false,true).animate({width:"100px"},{duration:300, queue:false});
    $("#dynamicregisterbutton").stop(false,true).animate({height:"32px"},{duration:300, queue:false}); 
}

Upvotes: 1

palaѕн
palaѕн

Reputation: 73906

Try replacing all your codes like:

$.("#dynamicloginbutton")    // Error in `$.()`

to a valid jQuery code like:

$("#dynamicloginbutton")     // just `$()` 

Upvotes: 4

Related Questions