grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

How to grab the html code using javascript

Open JPPreusDev opened this issue 8 years ago • 4 comments

I would like to grab the contents of the created HTML document using javascript so I can submit it using a form. How would I select the HTML content?

JPPreusDev avatar Jun 25 '18 08:06 JPPreusDev

https://github.com/artf/grapesjs/wiki/API-Editor#gethtml

cjpollard avatar Jun 25 '18 09:06 cjpollard

These two lines of code give you the html and the css

var Html = editor.getHtml(); var Css = editor.getCss();

ivanezeigbo avatar Jun 25 '18 10:06 ivanezeigbo

Great! Thank you.

JPPreusDev avatar Jun 30 '18 00:06 JPPreusDev

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Sep 17 '19 11:09 lock[bot]