jquery get element with specific attribute value
I have the following HTML with data attributes - I want to write some jQuery that will loop through the HTML and collect the data attributes and put them into an array - could anyone assist as Im getting an error.itemis not a jQuery object, the arguments foreachare the index and the native DOM element. jQuery gives us the means to easily manipulate an elements attributes and gives us access to the element so that we can also change its properties. Get Attribute Value. .each(element.get(0).attributes, function(i, attrib) attributes[attrib.name] attrib. valueAfter running the snippet above on the node we can now access the values on the attributes object we created like so We have so many situations in jQuery to find out an ELEMENT which has a specific attribute or an attribute with a specific value.