Add text to textarea - Jquery

后端 未结 2 876
别那么骄傲
别那么骄傲 2020-12-10 00:38

How can I add text from a DIV to a textarea?

I have this now:

    $(\'.oquote\').click(function() { 
      $(\'#replyBox\').slideDown(\'slow\', funct         


        
相关标签:
2条回答
  • 2020-12-10 00:46

    Just append() the text nodes:

    $('#replyBox').append(quote); 
    

    http://jsfiddle.net/nQErc/

    0 讨论(0)
  • 2020-12-10 00:57

    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.

    0 讨论(0)
提交回复
热议问题