11 points

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


dashboard

Sun Jan 26 2020 21:18:49 GMT+0000 (UTC)

Posted 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_copy Copy

The value of x will be "address"