Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
167
rated 0 times [  173] [ 6]  / answers: 1 / hits: 62934  / 13 Years ago, mon, april 4, 2011, 12:00:00

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()?


I think I need to convert textarea to a JavaScript object first, but how do I?


More From » jquery

 Answers
64

You can use the dereferencing operator, or the .get() method to Retrieve the DOM elements matched by the jQuery object.



Examples:



txtArea[0].value = something;


or:



txtArea.get(0).value = something;

[#92924] Saturday, April 2, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
diane

Total Points: 264
Total Questions: 104
Total Answers: 95

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
;