Search comma-separated list attribute using jQuery
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 var exists = $.inArray(“nature”, $(“#img1”).attr(“tags”).split(‘,’)) != -1;
Search comma-separated list attribute using jQuery Read More »