How to get the value of textarea/stage element via jquery correctly? #13310
-
I'm trying to understand how setting/getting the value of a textarea works. 1- there is a textarea inside an element. i can see a stage element for this textarea in firefox inspector. why textarea input, textarea element and stage element are not synced always? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is more of a general JavaScript/HTML question. Craft doesn’t do anything special here. The
To get the value of a textarea, you should use |
Beta Was this translation helpful? Give feedback.
This is more of a general JavaScript/HTML question. Craft doesn’t do anything special here. The
<textarea>
is just a<textarea>
..text()
is for getting the HTML-encoded textual value of an element, or setting a value that should become HTML-encoded.To get the value of a textarea, you should use
.val()
instead (('#textareaField').val()
).