使用jQuery将值追加到textarea [英] Appending values to textarea with jquery
本文介绍了使用jQuery将值追加到textarea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将下拉列表中的值添加到textarea,这是可行的,我可以添加值,但是当我在textarea上进行更改时,在编辑文本区域时无法再添加了..
I'm trying to append the value from dropdown to textarea, This is working, I can add value but when I make changes on textarea, I can't add anymore when I edit the text area..
$('#addWord').click(function() {
$('#textarea').append($('#selectbox').val() + ", ");
});
推荐答案
尝试使用.text()
代替.append()
$('#addWord').click(function() {
$('#textarea').text($('#selectbox').val() + ", ");
});
这篇关于使用jQuery将值追加到textarea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文