Simple jQuery code contains a syntax error that I can't find

Posted by inkedmn on Stack Overflow See other posts from Stack Overflow or by inkedmn
Published on 2010-04-01T17:11:54Z Indexed on 2010/04/01 17:13 UTC
Read the original article Hit count: 306

Filed under:
|
|

I've got this (remarkably) simple JavaScript function that is called when a user clicks a "Cancel" link:

function hideNewUserPanel(){
    $('#create_user_panel').slideUp('slow');
    $('.right_interior_panel').slideDown('slow');
}

And the code to add the handler:

$(function(){
    $('#cancel_create_user_btn').live('click', 
        function(){ hideNewUserPanel(); }
});

Functionally, everything works as expected. Trouble is, when I click the "Cancel" link, Firebug shows an error in the console:

uncaught exception: Syntax error, unrecognized expression: #

I've stepped through the code several times and the error appears at some point before the call to hideNewUserPanel(). At the risk of sounding like one of "those programmers" (the kind that claim to have found a bug in GCC and assume their own code is perfect), the exception is being thrown from somewhere within jQuery proper, so I assume the issue is in there. I'm using jQuery 1.3.2 (this is a legacy project using many jQuery plugins that will break if we update to 1.4.x).

Is there anything obviously wrong with my code that I'm simply not seeing? This code is, frankly, very simple and I don't really see what the issue could be.

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript