I have a on a form of mine. I´m trying to reset the value (the value typed by the user) of this field on a certain event. However, I seem unable to access it both with .val() and .html().
Any advice on this?
I have a on a form of mine. I´m trying to reset the value (the value typed by the user) of this field on a certain event. However, I seem unable to access it both with .val() and .html().
Any advice on this?
Set an id on that field so you can easily target it with $('#the_id')
.
If it's a textarea use .text(''), input use .val('')
Do not use .html()
, use .val()
.
$("#your_textarea_id").val("Some literal <textarea> content.");
This way special characters (<
, >
etc) will show up correctly.