0

Can anybody tell me why I get no output from this function?

$('.jqte_editor').bind('paste', function() {
    console.log("hi")
});

I have also tried on(

$('.jqte_editor').on('paste', function() {
    console.log("hi")
});

HTML:

<textarea class="jqte" style="margin-bottom: -20px;" rows="50" cols="50" name="body" id="body"></textarea>

Rendered HTML:

enter image description here

  • 1
    I can't reproduce this. Is it possible that you are binding the event before the editor's html is created? Can you replicate this on a jsfiddle? – cviejo Dec 28 '15 at 18:48
  • It's very likely that what @cviejo has mentioned in his comment is the cause of the issue here. That is, the bind statement is being executed before the HTML div is created in the DOM. – Andrew Tomlinson Dec 28 '15 at 19:22
  • Functions are inside of `$(window).load(function () {`. –  Dec 28 '15 at 19:32

1 Answers1

0

Try this.

$(document).on("paste", ".jqte_editor", function(e) {

//Do here what you want.

});

Ghost Rider
  • 161
  • 1
  • 1
  • 10