0

Dynamically generates one textarea if button is clicked ? Guide plz

https://code.sololearn.com/WJ7MA1CyrYWD/?ref=app

29th May 2022, 10:09 PM
Haseeb Shahzad
Haseeb Shahzad - avatar
1 Resposta
+ 2
You need to create the element first, then append the element to the appropriate DOM node function show() { const txtArea = document.createElement( "textarea" ); // create <textarea> element txtArea.rows = 10; // define row count txtArea.cols = 40; // define column count txtArea.placeholder = "this is a textarea element"; // define placeholder text document.body.appendChild( txtArea ); // append the element to document body } References: https://developer.mozilla.org/id/docs/Web/API/Document/createElement https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
30th May 2022, 12:43 AM
Ipang