Reputation: 1571
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() + ", ");
});
Upvotes: 0
Views: 78
Reputation: 2137
You can treat a textarea like any other input and use val()
$('#addWord').click(function() {
$('#textarea').val($('#textarea').val()+" "+$('#selectbox').val());
});
Working example: http://jsfiddle.net/BwV9F/
Upvotes: 1
Reputation: 8793
Try it using .text()
instead of .append()
$('#addWord').click(function() {
$('#textarea').text($('#selectbox').val() + ", ");
});
Upvotes: 2