Jivan Jivan - 8 months ago 62
Javascript Question

Special characters in data attribute values

I have an html content where this can be found:

<li data-id="87dhqsiu37fGyqUNA786d6F7=">

Note the
sign at the end of the data attribute value

How can I select it using a jQuery selector?

I tried this without success:

$("li [data-id=87dhqsiu37fGyqUNA786d6F7]")
$("li [data-id=87dhqsiu37fGyqUNA786d6F7\=]")
$("li [data-id=87dhqsiu37fGyqUNA786d6F7\u003D]")
$("li [data-id=87dhqsiu37fGyqUNA786d6F7&#61;]")

Each time gets me a Syntax Error (except for the first line, which just doesn't find the element).


$("li [data-id=87dhqsiu37fGyqUNA786d6F7]") This syntax was not working with updates libraries.

Now the correct syntax is