Javascript Jquery onchange等无法检测何时使用Jquery更改输入 $('#kv-error-1').bind(“domsubtredemodified”,function(){ var text=$('#kv-error-1')。text(); var matches=text.split(“-xar-”); $('#test')。文本(匹配[1]); }); $('#test').bind(“更改键控输入”,函数()){ var matchtx=$('#test').text(); matches=matchtx.split(“-xbol-”); 对于(i=1;i
我使用这个函数进行了更改,但如果我使用DOM,它会带来很多通知,但它必须执行一次。有些事件无法读取更改。如何使用更改事件处理程序Javascript Jquery onchange等无法检测何时使用Jquery更改输入 $('#kv-error-1').bind(“domsubtredemodified”,function(){ var text=$('#kv-error-1')。text(); var matches=text.split(“-xar-”); $('#test')。文本(匹配[1]); }); $('#test').bind(“更改键控输入”,函数()){ var matchtx=$('#test').text(); matches=matchtx.split(“-xbol-”); 对于(i=1;i,javascript,jquery,Javascript,Jquery,我使用这个函数进行了更改,但如果我使用DOM,它会带来很多通知,但它必须执行一次。有些事件无法读取更改。如何使用更改事件处理程序 $('#kv-error-1').bind("DOMSubtreeModified",function(){ var text = $('#kv-error-1').text(); var matches = text.split("-xar-"); $('#test').text(matches[1]); }); $('#test').bi
$('#kv-error-1').bind("DOMSubtreeModified",function(){
var text = $('#kv-error-1').text();
var matches = text.split("-xar-");
$('#test').text(matches[1]);
});
$('#test').bind("change keyup input",function(){
var matchtx = $('#test').text();
matches = matchtx.split("-xbol-");
for (i = 1; i < matches.length; i++) {
bolumler = matches[i].split("-xtes-");
new PNotify({
title: bolumler[0],
icon: "fa fa-"+bolumler[1]+" fa-2x",
addclass: "bg-"+bolumler[2],
hide: true
});
}
});
如果我正确理解您的问题,您可以为事件添加触发器
$( "#test" ).change(function() {
alert( "text changed!" );
});
$('#test')。触发器('change');
您会收到很多通知,因为您添加了3个事件列表器(change keyup input)也可以将html放在您的帖子中。我刚刚在JSFiddle中尝试了你的代码,它很有效。 $('#test').trigger('change');