0

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?

3
  • The first question is of course, are you sure the jQuery lib is loaded correctly? Commented Aug 5, 2013 at 13:52
  • Yes, I believe so. I am using one of the google links. I'll add that to me post. Commented Aug 5, 2013 at 13:53
  • 1
    You have an extra . between the $ and selector in the mLeave() and 1mEnter` functions Commented Aug 5, 2013 at 13:54

2 Answers 2

4

Try replacing all your codes like:

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

to a valid jQuery code like:

$("#dynamicloginbutton")     // just `$()` 
Sign up to request clarification or add additional context in comments.

Comments

1

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}); 
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.