Jquery:这里应该给出什么函数[更改或其他函数]
Jquery:这里应该给出什么函数[更改或其他函数],jquery,jquery-selectors,Jquery,Jquery Selectors,如代码$(“#check”).change(function()中所示,它不起作用?我应该使用什么函数来实现Jquery?当我要添加的输入文本框中的复选框发生更改时?这只是一个示例您只需要在设置值时手动触发更改事件: $("#paymenttype").change(function(){ $("#check").val($('#paymenttype option:selected').text()); }); $("#check").change(function(){ alert("so
如代码
$(“#check”).change(function()
中所示,它不起作用?我应该使用什么函数来实现Jquery?当我要添加的输入文本框中的复选框发生更改时?这只是一个示例您只需要在设置值时手动触发更改事件:
$("#paymenttype").change(function(){
$("#check").val($('#paymenttype option:selected').text());
});
$("#check").change(function(){
alert("soul");
$("#update").val(0);
});
尝试添加触发器
(function($) {
$.fn.changeVal = function(value) {
return this.val(value).change();
};
})(jQuery);
注意第二行末尾的.change()
在“#check”上使用函数运行change()处理程序
change
将在元素失去焦点时立即触发。@当我要添加的输入文本框中的复选框发生更改时,jamesalardice?这只是一个示例example@Tomalak-我认为问题在于绑定到#check
的change
事件从未触发(而且永远不会,因为元素是只读的),所以Richard D的答案是正确的。
$("#paymenttype").change(function(){
$("#check").val($('#paymenttype option:selected').text()).change(); // <-- HERE
});
(function($) {
$.fn.changeVal = function(value) {
return this.val(value).change();
};
})(jQuery);
$("#paymenttype").change(function(){
$("#check").val($('#paymenttype option:selected').text()).change();
});