0
Dynamically generates one textarea if button is clicked ? Guide plz
1 ответ
+ 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