If i am adding the change eventListener it take the value as a change i want to take a string through textarea and display it with textContent on HTML page, Please Help!
Asked
Active
Viewed 23 times
-2
-
2Please post a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – Ele Jul 17 '18 at 21:45
-
Possible duplicate of [Textarea onchange detection](https://stackoverflow.com/questions/2823733/textarea-onchange-detection) – Dillon Davis Jul 17 '18 at 22:19
2 Answers
0
Try this example
<!DOCTYPE html>
<html>
<body>
<input type="number" id="myNumber" value="2">
<p>Click the button to change the number of the number field.</p>
<button onclick="myFunction()">Try it</button>
<p><strong>Note:</strong> input elements with type="number" are not supported in IE 9 and earlier versions.</p>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myNumber").value = "16";
}
</script>
</body>
</html>

George C.
- 6,574
- 12
- 55
- 80
0
kinda hard to get into the question. did you mean something like this?
document.getElementById('textarea').addEventListener('change', e => {
div.textContent = e.target.value;
});

Nerolis
- 26
- 3