Topic: Wysiwyg extracting HTML
hello ! I have been searching for the right way to extract the wysiwyg HTML edited content for saving the inner HTML to a database for later presentation. would you please point me to the right spot ? thanks!
Bartłomiej Malanowski staff pro premium answered 6 years ago
$('#myTextarea').val();
should give you HTML code ready to save it to save it to the database
Greg Beacher answered 6 years ago
Hello there,
A quick follow up question if I may - I am trying to extract the HTML from the WYSIWYG component within a PHP script.
After reading the above I created a hidden field on my form and added an onchange handler to my textarea that would take the .val() and drop it into the hidden field. I figured then I could submit this hidden field and get the HTML back to my PHP form handler.
The trouble is that the onchange event won't fire. If I remove the javascript to initialise the WYSIWYG component then it will work (but then I only have a normal textarea and not the nice component.
Is there a way to get the onchange (or an alternative event) to fire for the WYSIWYG component so that I can actually grab the HTML please.
Kind Regards
Greg
Bartłomiej Malanowski staff pro premium commented 6 years ago
What are the steps to reproduce your issue?
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.6.1
- Device: PC
- Browser: Edge
- OS: Windows 10
- Provided sample code: No
- Provided link: No