Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
How to submit form with tinymce on blur?

I want to save the form data with ajax. I can pass all fields to DB but textarea with tinymce implemented. My method is 'onblur'. When remove a cursor from an element the ajax is triggered.

tinymce.init({
  selector: 'textarea',
  plugins: 'code image example',
  toolbar: 'alignleft,aligncenter,alignright | code | image example',
  statusbar: false,
  menubar: true,
});


$('#food_form').on('keyup change paste blur', 'input, select, textarea', function() {
  $.ajax({
    url: 'food_db.php',//send form info here
    type: 'POST',
    data: $('#food_adder').serialize(),
    success: function(resp) {
      $('#resp').html(resp).show();//show result from ajax
    }
  }); //ajax
}); //on key change
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.4/tinymce.min.js"></script>

<form id="food_form">
  <input type="text" name="title" placeholder="Menu title"/>
  <textarea name="desc" placeholder="Put your instruction here"></textarea>
</form>

I want 'textarea' to trigger the ajax to save data as well as input. I tested on my server and it works well with no error. Just wondering how to trigger the ajax with 'textarea' with tinymce applied to.

fiddle : http://jsfiddle.net/14bq59tw/

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!