<script>
function show(){
document.getElementById('showresult').innerHTML = document.getElementById('name').value;
}
</script>
<body>
<input id="name" onkeyup="show()"/>
<button onclick="show()">Show</button>
<p id="showresult"></p>
</body>
The innerHTML property sets or returns the HTML content (inner HTML) of an element.
function show(){
document.getElementById('showresult').innerHTML = document.getElementById('name').value;
}
</script>
<body>
<input id="name" onkeyup="show()"/>
<button onclick="show()">Show</button>
<p id="showresult"></p>
</body>
The innerHTML property sets or returns the HTML content (inner HTML) of an element.
Demo
0 comments:
Post a Comment