'parentElement()' Example : parentElement « Node Operation « JavaScript DHTML






'parentElement()' Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    var myRange = document.selection.createRange();
    var m = myRange.parentElement();
    m.innerText = 'ParentElement'; 
} 
</script>
<input id="myB" type="button" value="Click me" onclick="function1();">
</body>
</html>

    
      
      








Related examples in the same category