jQuery Attributes

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

The jQuery function .attr(), gets the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.

It is worth noting that when getting the value of an attribute, it only gets it from the first element that matches the selector (i.e. $("input").attr("type"); would only get the type of the first input, if there are more than one)

However, when setting an attribute, it will apply it to all matching elements.



Got any jQuery Question?