Get innerHTML from editable div element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Get innerHTML from editable div element

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w w  w.  j av  a2s .co m*/
console.log(document.getElementById("test").innerHTML)
    }

      </script> 
   </head> 
   <body> 
      <div style="border: 2px solid red; width: 300px; height: 300px;" contenteditable="true" id="test"> 
         <a href="mailto:John.Doe%40%65x%61%6Dple.com">John.Doe@example.com</a> 
      </div>  
   </body>
</html>

Related Tutorials