We would like to know how to get Button parent Node.
<!--from ww w.jav a 2 s. c o m-->
<html>
<body>
<form id="myForm">
<input id="myButton" type="button" value="Show parent node" onclick="function1();">
</form>
<script language="JavaScript">
function function1() {
var m = document.all.myButton.parentNode.id;
console.log("Parent node: <form>, id = "+'"'+m+'"');
}
</script>
</body>
</html>
The code above is rendered as follows: