I am developing a small tool for live editing using Chrome DevTools, and I have a small “Save” button that captures HTML and sends it to the server to update the static file (.html) using Ajax. Very simple.
My problem is that I need to filter the HTML code before sending it to the server, I need to delete some nodes, and I'm trying to achieve this using jQuery, something like this:
var html = $('<div>').append($('html').clone()).html();
$(html).find('#some-node').remove();
$.post('url/to/server/blahblahblah');
I already tried this. Using jQuery to search an HTML string without success. I cannot use jQuery for my cloned HTML code.
Any idea on how to do this?
source
share