Add text to textarea - Jquery
How can I add text from a DIV to a textarea?
I have this now:
$('.oquote').click(function() {
$('#replyBox').slideDown('slow', function() {
var quote = $('.container').text();
$('#replyBox').val($('#replyBox').val()+quote);
// Animation complete.
});
});
Just append()
the text nodes:
$('#replyBox').append(quote);
http://jsfiddle.net/nQErc/
That should work. Better if you pass a function to val
:
$('#replyBox').val(function(i, text) {
return text + quote;
});
This way you avoid searching the element and calling val
twice.