L
L
lilikon2017-08-03 08:32:39
JavaScript
lilikon, 2017-08-03 08:32:39

CKeditor needs to be double-clicked to send files?

There are several forms on the page that have a textarea that have a ckeditor connected to them.
When you try to send (the first click on the send button), a void is sent from the textarea field, when you click on send again, the necessary information is already sent (and the ckeditor editor).
The necessary info is sent from each form, BUT from the second click on the submit button .

The code:

for (instance in CKEDITOR.instances) {
        CKEDITOR.instances[instance].updateElement();
      }

This code works only on the first textarea, on it, after the first click on the send button, everything is sent the first time, but on others, this code does not work, and you have to click twice.

Part of the code for sending data:
$("form").submit(function(){
      var clickId = $(this);
      event.preventDefault();	
      for (instance in CKEDITOR.instances) {
        CKEDITOR.instances[instance].updateElement();
      }
      var formValid = true;
      var v3 = $(this).find("#editor").val();
      var formData = new FormData();
      formData.append('v3', v3);
      $.ajax({
...


How to make code
for (instance in CKEDITOR.instances) {CKEDITOR.instances[instance].updateElement();}
worked for all textarea, or so that you don't have to double-click on the send button?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question