Jivan Jivan - 1 year ago 140
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).

Answer Source

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

Now the correct syntax is

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download