Topic: Help getting html out of wysiwyg editors upon form submit

mleach free asked 2 years ago

I'm looking for a very straightforward example to get code out of a wysiwyg editor and submit it for writing to a database

I can get the text but not formatted html - need to figure out how to get the formatted stuff

I have multiple wysiwyg editors on the page...

currently I have multiple on page like this:

other text some text

I have javascript that pulls out the text for each of these - but cannot figure out how to get the full html code when I format these using the editor

here is the js

const formEl = document.querySelector('form');const persdevgoalArea = document.querySelector('.persdevgoal-area');const contactsArea = document.querySelector('.contacts-area');formEl.addEventListener('submit', (e) => { e.preventDefault(); alert('First area content:-->'+persdevgoalArea.innerText+'---- second content:'+contactsArea.innerText+'

  • I tried to figure out how to use the getCode in the api - but there is no real good tutorial or example that really shows this working, even more so when there are multiple editors on a page

please share any pointers.


mleach free commented 2 years ago

hmm... looks like the html was stripped from the post

will create snipped

Grzegorz Bujański staff answered 2 years ago

I created an example that gets all the wysiwyg editors on the site. Look at this snippet, the getCode method you mentioned was used there:

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: Mac
  • Browser: Chrome
  • OS: MacOS
  • Provided sample code: No
  • Provided link: Yes