If I have a textarea like var textarea = $('textarea'), how can I set the value to it using the JavaScript property value, and not the jQuery property val()?
textarea
var textarea = $('textarea')
value
val()
I think I need to convert textarea to a JavaScript object first, but how do I?
You can use the dereferencing operator, or the .get() method to "Retrieve the DOM elements matched by the jQuery object."
.get()
Examples:
txtArea[0].value = "something";
or:
txtArea.get(0).value = "something";
1.4m articles
1.4m replys
5 comments
57.0k users