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. }); });
To add text to a textarea, access the value property on the element and set it to its current value plus the text to be appended, e.g. textarea. value += 'Appended text' . The value property can be used to get and set the content of a textarea element.
it has two input textareas which will take the link and text inputted and make a shortcode for a user. var link = $('#link'). val(); var text = $('#linkText').
Answer: Use the jQuery text() method You can simply use the jQuery text() method to get all the text content inside an element. The text() method also return the text content of child elements.
Just append()
the text nodes:
$('#replyBox').append(quote);
http://jsfiddle.net/nQErc/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With