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

Leave a comment Standard

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.

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

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