开发者

jQuery :contains(unicode_characters)

I have an element like this:

<span class="tool_tip" title="The full title">The ful&#8230;</span>

This seems to work:

jQu开发者_运维知识库ery('span:contains(…)');

But this does not:

jQuery('span:contains(&#8230;)');

I am pretty sure that it would be bad to use the first one because if someone else saves the file, or the browser decides to get the file in a different character set for some reason things will not work.

There has to be a way to properly select this span, right?


As it turns out, the proper way to do this is:

jQuery('span:contains(\u2026)');

In other words:

Use the hex value instead of the decimal value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜