Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

271
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda