Windows – Linux – Mac OSX Guides

Search comma-separated list attribute using jQuery

WHAT I WANT

I have an attribute that is comma-separated list, and I want to search for a particular value in that list

example:

<img id=”img1” src=”somepic.jpg” tags=”nature,flower,color”>

SOLUTION

Using jQuery, it’s simple to do, for example, I will search for the tag “nature” in the image

Tagged with:     ,

Related Articles

Loading Facebook Comments ...

Post your comments

Your email address will not be published. Required fields are marked *