tags:

views:

18

answers:

1

I have elements with various values for an attribute (ids="32, 56, 21"). How can I get the elements that contain 21?

+1  A: 

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/

Richard