We would like to know how to get element tag Name.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!-- w w w .j a v a 2s . c o m-->
var element = document.getElementById('test');
var result = document.getElementById('result');
result.innerHTML = element.tagName.toUpperCase();
}
</script>
</head>
<body>
<input id="test" type="text"value"hello">
<div id="result"></div>
</body>
</html>
The code above is rendered as follows: