-->

Thursday, June 19, 2025

JavaScript Program to Use getElementById() to display text itself after typing | DOM Manipulation in JS with Examples

 

JS DOM programs collection




JavaScript Program to Use getElementById() to display text itself entered by user  using getElementById (DOM)






<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>auto appearing text</title>

</head>

<body>

<form>

enter your text:<br>

<input type="text" id="data" oninput="textappear()">


</form>

<p id="text">

</p>

<script type="text/javascript">

function textappear()

{

var t;

t=document.getElementById('data').value;

document.getElementById('text').innerText=t;

}

</script>


</body>

</html>

No comments:

Post a Comment