JQuery Documentation Gotcha

From HunterWiki

Jump to: navigation, search

So I blew several hours trying to track down a problem with my jQuery selector yesterday. Turns out that if you element ID has an '@' sign in it, that you have to escape it! Perhaps I should have known that, considering that the 'at' sign is an xpath special character, but I was thrown off by a post somewhere that said you no longer needed to use 'at' signs in your attribute selectors any more, and the fact that the official jQuery documentation didn't list the @ as a meta-character in need of escaping! See http://api.jquery.com/category/selectors/.

I confess that I had an initial problem where the @ was the first character in my ID, but was cured of that by a post noting that it was not officially a valid ID name. Sadly my particular data uses the @ sign extensively in the unique identifiers of key elements :< Luckily I have encountered this before the site went live! I'll probably opt to 'clean' the data on import rather than try to remember for ever after that any ID which is any way derived from these key values must be escaped.

Ugh.

Maybe this post will save some other wretch a few hours.

Personal tools