Skip to content Skip to sidebar Skip to footer

Jquery - Insert Text Inside Element Of A Html String

I store an html string into var HTML, which I get using the following: var HTML = $('.group').get(0).outerHTML; The output of HTML using console.log(HTML) is:
HTML string. You need to save the DOM elements in a variable.

var new_div = $(HTML);
new_div.find('.class2').text("Hello!");
console.log($(new_div).html());

Post a Comment for "Jquery - Insert Text Inside Element Of A Html String"