简体   繁体   中英

How can I add text in text area after I push value using Jquery

When I check box I get value and How can I add default text value

$(document).ready(function() {
    $('#email_getdata').click(function() {
      var favorite = [];
      $.each($("input[name='find_product']:checked"), function() {
        favorite.push($(this).val());
      });
        $("#getdata_checked").html("ITEM : " + favorite.join(",  "));
        // I want to add text after I get value here
        $( "$getdata_checked" ).after(function() {
          $("#getdata_checked").html("rrr: ");
        });

    });
  });

I want to add default text in text area after I get item value

I want to display something like item1,item2 <- which I already get by input check

You can fetch content using $("#getdata_checked").html() and then append it..

$( "$getdata_checked" ).after(function() {
  var content = $(this).html();
  $("#getdata_checked").html("rrr: " + content);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM