Did you know whether it is possible to run jQuery for a variable containing html, and not just for the document itself.
Example:
bg.inspectorGetRawHtml = function(){
var c = jQuery("#bg-admin-inspect-wrapper").html();
jQuery(".bg-admin-inspect-state", c).remove();
console.debug(c);
}
So basically reading a segment of html pages into a variable and then doing jQuery manipulation on that line.
If I console.debug, then the actual jQuery is deleted, it seems like a match, but var is not processed. I know jQuery relies on the DOM, and maybe thatβs why it doesnβt work, but if anyone has an understanding of this.
Edit
After the lonesomeday suggestion, here is the code I got into:
bg.inspectorGetRawHtml = function(){
var c = jQuery("#bg-admin-inspect-wrapper").clone();
jQuery(".bg-admin-inspect-state", c).remove();
console.debug(c.html());
}
source
share