I would like to create some dynamic elements in javascript using jquery pop them into a variable and then access them. I am wondering whether the following is somehow possible?
var content=$("<div>Person<div>Name</div><div>Surname</div></div>");
content.find("div").each(function(){
//do something
});
JQuery provides .each method which can be used like this.
But obviously, the changes will be visible only if you add them to the DOM as right now these elements are in a seperate DocumentFragment.