Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 2011-02-28: The Cowbell Isn't Going To Ring Itself

Ask for Help

“jQuery throwing a syntax error when using is("[data-foo]")?”

Has anyone seen jQuery throw a syntax error when passing a data- attribute name to the is() function? This code often works, but started throwing a syntax error after some markup was removed and then re-inserted into the DOM:

$("#foo").attr("data-bar") = 5;

Interesting Things

  1. Shouldn’t that be :

    $(“#foo”).attr(“data-bar”, 5);

    I’m pretty sure what you have there doesn’t work…

  2. Erik Hanson says:

    Ooops, yeah I had it right when I was trying it out but failed to paste in the right code :)

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *