hasAtrr()
The hasAttr method checks if an element have specific attributes.
Returns
trueif all specified attributes exist.falseotherwise.
Usage
For Single Elements
$('.button').hasAttr('id'); // Checks if the element has an 'id' attribute
$('.link').hasAttr('href', 'target'); // Checks for multiple attributesFor Collections
$('img*').hasAttr('src'); // Checks if all <img> elements have a 'src' attribute
$('input').hasAttr('type', 'name'); // Checks if all <input> elements have both attributesLast updated