开发者

javascript/jquery trigger a text change event on a textarea

Is there anyway to trigger the textChanged event in a text area using javascript or jquery ?

I want the textchange event to occur once 开发者_StackOverflow中文版the page is loaded.


$(document).ready(function() {
   $('textarea').trigger('change');
});

But this will only trigger if the change event was added through jQuery. If not you could try:

$('textarea').get(0).change();


Have you tried:

$(function(){
    $("textarea").change()
})


In my case, I have to use the event input since my textarea used as emoji field.

For ex.

$('textarea').trigger('input');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜