I have a string that contains html elements such as the following
var elements = "<div class='instance' id=''><h1></h1></div>";
how can work with it in order to be able to make like this
$('instance').prop('id',5);
$('instance h1').html('hello all');
You can load it directly into a new jQuery object:
Also,
5is not a validid– please don’t use numbers at the beginning of anidvalue.