Skip to content Skip to sidebar Skip to footer

How To Add Html Content Of Selected Div Into A Textarea?

The following works fine, but when I add the html into the textarea, I am also wrapping the div within another div, breaking the layout. What I am trying to achieve is to place th

Solution 1:

Eventually I resolved it by using .prop() and outerHTML

$('body').on('click', '.btn_video', function() {
   var $imageSelected = $(this).parent().parent().parent().prop('outerHTML');
   $('#usp-custom-5').val(function(_, currentValue) {
      return currentValue + $imageSelected
    });
 });

Post a Comment for "How To Add Html Content Of Selected Div Into A Textarea?"