Returns whether this node (if it is an element) has any attributes
Syntaxvar bResult = object.hasAttributes();
Return Value
Returns an object of type BooleanBoolean
true if this node has any attributes, false otherwise.
ExamplesThe following example will display an alert message that "the root element has attributes’. No following alert is displayed for the body element as it has no attributes.
<!DOCTYPE html>
<html id="root" class="desktop">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>hasAttributesExample</title>
</head>
<body>
<script type="text/javascript">
var re=document.getElementById('root');
if(re.hasAttributes()){alert('the root element has attributes');}
var be=document.body;
if(be.hasAttributes()){alert('the body element has attributes');}
</script>
</body>
</html>
Notes Remarks
The hasAttributes method determines whether the object has any attributes at all. The hasAttribute method tests for the existence of a specified attribute.
Related specificationsMozilla Developer Network : [Node.hasAttributes Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4