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: fixes for errors, javascript, jquery, jquery fix, programming error, programming error fix.
Trackback this post | Subscribe to the comments via RSS Feed