87,994
社区成员




$("#unThecoupon").bind("click",function() {
$("[name = paymentType]").each(function() {
//货到付款
if($(this).val()=='2') {
$(this).attr("checked",false);
if($("#unThecoupon").prop('checked')) {
$(this).click(function() {
alert("生成团购券的团购只能在线支付或服务台pos刷卡,不支持货到付款");
$(this).attr("checked",false);
});
} else {
$(this).unbind('click');
}
}
//在线支付 ,服务台pos刷卡
if($(this).val()=='1' || $(this).val()=='3') {
$(this).attr('checked',$("#unThecoupon").prop('checked'));
}
});
});
$("#unThecoupon").change(function () {
var isChecked = $(this).prop('checked');
alert(isChecked); //true or false
alert(typeof(isChecked)); //boolean
});
$("#unThecoupon").click("input propertychange",function() {
alert($("#unThecoupon").is(':checked'));
$("[name = paymentType]").each(function() {
//货到付款
if($(this).val()=='2') {
$(this).attr("checked",false);
if($("#unThecoupon").is(':checked')) {
$(this).click(function() {
alert("生成团购券的团购只能在线支付或服务台pos刷卡,不支持货到付款");
$(this).attr("checked",false);
});
} else {
$(this).unbind('click');
}
}
//在线支付 ,服务台pos刷卡
if($(this).val()=='1' || $(this).val()=='3') {
$(this).attr('checked',$("#unThecoupon").prop('checked'));
}
});
});
//默认选中生成团购券
$("#unThecoupon").click();
alert($("#unThecoupon").is(':checked'));
alert出来是false,不知道为什么。在我的预想中应该是ture才对[/quote]
======================================
<label for="ch1">ok</label>
<input type="checkbox" id="ch1" />
<button onclick="tri();">trigger</button>
JS:function tri(){
$("#ch1").trigger("click");
}
上面代码测试后,出发点击事件可以模拟点击选中,checkbox;所以楼主思路肯定没问题
$("#unThecoupon").click("input propertychange",function() {
alert($("#unThecoupon").is(':checked'));
$("[name = paymentType]").each(function() {
//货到付款
if($(this).val()=='2') {
$(this).attr("checked",false);
if($("#unThecoupon").is(':checked')) {
$(this).click(function() {
alert("生成团购券的团购只能在线支付或服务台pos刷卡,不支持货到付款");
$(this).attr("checked",false);
});
} else {
$(this).unbind('click');
}
}
//在线支付 ,服务台pos刷卡
if($(this).val()=='1' || $(this).val()=='3') {
$(this).attr('checked',$("#unThecoupon").prop('checked'));
}
});
});
//默认选中生成团购券
$("#unThecoupon").click();
alert($("#unThecoupon").is(':checked'));
alert出来是false,不知道为什么。在我的预想中应该是ture才对$(sele).on("input propertychange", function () {
//相关操作
});