访问textarea值 [英] access textarea value
本文介绍了访问textarea值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于我的形式.我正在尝试在特定事件上重置此字段的值(用户键入的值).但是,我似乎无法同时使用.val()和.html()来访问它.
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().
对此有何建议?
推荐答案
请勿使用.html()
,请使用.val()
.
$("#your_textarea_id").val("Some literal <textarea> content.");
这样特殊字符(<
,>
等)将正确显示.
This way special characters (<
, >
etc) will show up correctly.
这篇关于访问textarea值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文