JQuery FIX: uncaught exception: Syntax error, unrecognized expression: #

November 17, 2011 at 7:49 pm Leave a comment

This one threw me for a bit of a loop today so I thought I’d share. I couldn’t get my debugger to give me a line number for this error, however it turns out I had a double # sign in my jQuery code.

<script>
$("##myButton").click(function () { alert('You are pressing my buttons'); });
</script>

Notice the duplicate pound sign (#) in the ID reference for the button. Remove the duplicate pound sign and you should be good to go.

Advertisement

Entry filed under: Code Snippets, Fixes For Errors, for Javascript, Free Code, Javascript, jQuery, Programming Languages. Tags: , , , , , .

DOJO Grid FIX: Showing/Hiding Grid Causes Grid Headings To Disappear How Much Does It Cost To Create A Flash MMO?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Lost In Oblivion

November 2011
M T W T F S S
« Oct   Dec »
 123456
78910111213
14151617181920
21222324252627
282930  

Recent Posts

Feeds


Follow

Get every new post delivered to your Inbox.