开发者

How to detect if an attribute contains a certain value in jQuery?

I have elements with various values for an attribute (ids="32, 56, 21"). How can I get the element开发者_开发百科s that contain 21?


You want to use this:

$("[ids~=21]")

there must be a space between the attribute values.

You may have to use:

 $("[ids~=21],[ids~=21,]")

see this link: http://api.jquery.com/attribute-contains-word-selector/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜