Topic: Trying to save WYSIWYG onfocusout() event but toolbar causes focus to be lost
kylesullens priority asked 3 years ago
Expected behavior I am aiming for a single save to database (via javascript function call) when the jQuery WYSIWYG loses focus. The user should be able to edit the contents of the WYSIWYG with formatting and styling available in the toolbar without the WYSIWYG trigging the onfocusout() event. Is it possible to accomplish a single javascript function call when a user moves on to editing a different input or other action on page?
Actual behavior Applying any style or formatting from the WYSIWYG toolbar causes the event to fire.
Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/jquery/kylesullens/2324199#js-tab-view
Krzysztof Wilk staff answered 3 years ago
Hi!
I think it is not achievable. You can try to make one handler for onfocusout event for every input on your page and check if id of an element is last in your editor, but I think it may be buggy.
In my opinion, the best way to handle this case is to wrap your editor into the <form>
tag, then make a submit button that the user has to click on his own.
Best regards
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB jQuery
- MDB Version: 4.19.1
- Device: PC
- Browser: Google Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: Yes