Javascript examples for DOM HTML Element:Textarea
Add input event handler to <textarea>
<html> <head></head> <body> <textarea id="list" placeholder="Enter your list"></textarea> <script> var textarea = document.getElementById('list'); var arr = [];//from ww w.j av a 2s .com textarea.addEventListener('input', function () { arr = this.value.split('\n'); console.log(arr); }, false); </script> </body> </html>