Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>HTML DOM Attributes</h1>
<h2>The length Property</h2>
<img id="myImg" alt="Flower" src="klematis.jpg" width="150" height="113">
<p>The number of attributes of the image are:</p>
<p id="demo"></p>
<script>
let num = document.getElementById("myImg").attributes.length;
document.getElementById("demo").innerHTML = num;
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_node_attributes3 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:43 GMT -->
</html>