[英]jQuery .val('') does not clear text area input
I want to clear the user input in a text area field, but it does not work. 我想清除文本区域中的用户输入,但这不起作用。 When I print the value in the browser's console it appears to be "empty", but the text still exists in the field.
当我在浏览器的控制台中打印该值时,它似乎是“空”的,但该文本仍然存在于该字段中。
I am using Meteor 0.9.3. 我正在使用Meteor 0.9.3。 Here is my code:
这是我的代码:
Meteor.call('submitMessageForChat', message, this._id, function(error) {
if (error) {
throwWarning('error', error.reason, error.details);
return null;
}
$('#chat-input').val('');
});
<textarea id="chat-input" name="message" type="text" value="" rows="5" class="form-control"></textarea>
Any help would be greatly appreciated! 任何帮助将不胜感激!
use: 采用:
$('#chat-input').html(''); but `val('');` should also work.
there is no tag type="text"
for textarea. textarea没有标签
type="text"
。
you can use: 您可以使用:
$('textarea').val('');
also. 也。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.