Jquery 如何向我的IF添加多个条件?
如何向我的IF添加多个条件? 我试过这样的方法:Jquery 如何向我的IF添加多个条件?,jquery,Jquery,如何向我的IF添加多个条件? 我试过这样的方法: $('#ok').click(function(){ if($('#accept-check:checked').length == 1 && #owner.length > 4 && #number.length == 8 ){ $('#open-box').removeAttr('disabled'); $('#open-box').attr
$('#ok').click(function(){
if($('#accept-check:checked').length == 1 && #owner.length > 4 && #number.length == 8 ){
$('#open-box').removeAttr('disabled');
$('#open-box').attr('onclick','javascript:yourFunctionName();');
}
else{
$('#open-box').removeAttr('onclick');
$('#open-box').attr('disabled','disabled');
}
});
如果出现这种情况,请使用
if(acceptCheckLength == 1 && ownerLength> 4 && numberCheckLength == 8 )
您没有正确写入条件。请尝试以下操作:
if($('#accept-check:checked').length == 1 && $('#owner').length > 4 && $('#number').length == 8 ){
//do stuff here
}
第二行是错误
if($('#accept-check:checked').length == 1 && $('#owner').length > 4 && $('#number').length == 8 ){
//do stuff here
}