In an Rails app I want to modify the DOM of a web page using javascript
Can I save the resulting HTML (of the whole page) after each modification to a database?
Thanks.
After the html is appended, just press Ctrl+S to save the file locally with modified html.
The document. write() method writes a string of text to a document stream opened by document.
The write() method writes directly to an open (HTML) document stream.
The write() method in HTML is used to write some content or JavaScript code in a Document. This method is mostly used for testing purpose. It is used to delete all the content from the HTML document and inserts the new content. It is also used to give the additional text to an output which is open by the document.
With jQuery you could use var html = $(document).html();
Then post the html with $.ajax()
to the controller where you choose to save it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With