Javascript examples for DOM HTML Element:Input Text
Show source code of HTML element on click to form input
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript"> function showSourceCode(toShow){// www .jav a2 s. c o m sourceCode.value = toShow.innerHTML; } </script> <p onclick="showSourceCode(this);"> <b>Show source code when this text is clicked!</b> </p> <p onclick="showSourceCode(this)"> <i>show source code on click!</i> </p> <input type="text" id="sourceCode"> </body> </html>