radio与checkbox的选中事件
<⼀>判断checkbox的选中事件
var result=$(this).find("input[type='checkbox']").prop("checked");
result 是bool类型的值 true是选中的状态 false是没选中的状态
checkbox标签已有checked=checked但是不显⽰勾选ind){ $("#isremind").prop("checked",true); }else{ $("#isremind").removeAttr("checked"); }
添加的时候⽤prop,取消⽤removeAttr。
<⼆>radio的选中状态
htmlradio添加切换事件//付款⽅式
$('div#pay-type input[type="radio"] ').each(function (e) {
var radiotype = $(this).attr("checked");
if (radiotype == "checked") {
paytype = $(this).attr("tid");
}
});
var radiotype = $(this).attr("checked");
如果radiotype == "checked"就是选中
find就相当与children
closet就相当于parent
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论