将粘贴函数绑定到JQuery文本编辑器

时间:2015-12-28 18:19:31

标签: javascript jquery html html5 jqte

有人可以告诉我为什么我没有得到这个函数的输出吗?

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

我也试过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>

呈现HTML:

enter image description here

1 个答案:

答案 0 :(得分:0)

试试这个。

$(document).on(&#34; paste&#34;,&#34; .jqte_editor&#34;,function(e){

//Do here what you want.

});