Add text to textarea - Jquery

后端 未结 2 883
别那么骄傲
别那么骄傲 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: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.

提交回复
热议问题