Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

269
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda