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