How can I apply a function to wysihtml5 texteditor?

265 views Asked by At

Like this my function is working fine:

 $(".textarea").on("change keyup paste", function (){
      console.log("something happens");
  });

But when I want to apply it to my wysihtml5 it does not work anymore..

$('.textarea').wysihtml5();
$(".textarea").on("change keyup paste", function (){
      console.log("something happens");
});
1

There are 1 answers

0
peace_love On BEST ANSWER

Working solution:

$('.textarea').wysihtml5({
       events: {
           load: function() {
               var some_wysi = $('.textarea').data('wysihtml5').editor;
               $(some_wysi.composer.element).bind('keyup', function(){ 
                     console.log("something happens");
               });
            }
       }
});