Answers for "jquery loop print html()"

0

jquery loop print html()

$('.victim').html(''); //clear the victim if needed
$('.victim').each((index, element) => {

  var htmlString = '<div class="someclass">';
  htmlString += '<span>' + element.text + '</span>';
  htmlString += '</div>';
  $('.victim').append(htmlString); //add the current content to existing one
}); //end each
Posted by: Guest on March-04-2022

Browse Popular Code Answers by Language