getAttribute() - how to get the value of any attribute of HTML element

PHOTO EMBED

Sun Jan 26 2020 21:18:49 GMT+0000 (Coordinated Universal Time)

Saved by @_right_away_ #html #javascript #jsfunctions #dom #dommanipulation

<html>

<input id="contact" name="address">

<script>

    var x = document.getElementById("contact").getAttribute('name');

</script>

</html>
content_copyCOPY

The value of x will be "address"