您好我有一个表单我想验证字段,我现在正在使用float sx=0.5f; // slow down translation factor in x axis by half
float sy=0.5f; // slow down translation factor in y axis by half
model.getSprite().translate(x*sx, y*sy);
第一个字段jquery
验证工作正常它禁用按钮直到电话字段为空。在第二个字段之后,数字条件很好,但问题是它不是检查第一个字段是否为空。意味着条件变为真,而不检查第一个字段是否为空。希望我能够全面了解我的问题
jQuery代码
name
我的表单
jQuery(document).ready(function($) {
setTimeout(function(){
$('#sfp_Modal').modal('show');
}, 3000);
/*
$( ".sfpsubmit, .close" ).click(function() {
var sfp_cookie = $.cookie('SFPopup', 'sf_popup', { expires: 7 });
alert(sfp_cookie);
if(sfp_cookie == null){
setTimeout(function(){
$('#sfp_Modal').modal('show');
}, 3000);
}else{
$('#sfp_Modal').modal('hide');
}
}); */
$( "#sf-popup .sfname" ).keyup(function() {
if($(this).val() == '' || $( "#sf-popup .sfphone").val() == '' || $.isNumeric(sfp_phone) == true){
$('#sfpsubmit').attr('disabled','disabled');
} else{
$('#sfpsubmit').removeAttr('disabled');
$( ".sfp_btn" ).click(function() {
$('#sfp_Modal').modal('hide');
});
}
});
$( "#sf-popup .sfphone" ).keyup(function() {
var sfp_phone = $(this).val();
if(sfp_phone.length > 10){
$(this).val($(this).val().substr(0,10));
$('#sfpsubmit').removeAttr('disabled');
}
if(sfp_phone == '' || $( "#sf-popup .sfname").val() == '' || $.isNumeric(sfp_phone) == false || sfp_phone.length < 10){
$('#sfpsubmit').attr('disabled','disabled');
} else{
$('#sfpsubmit').removeAttr('disabled');
$( ".sfp_btn" ).click(function() {
$('#sfp_Modal').modal('hide');
});
}
});
$( "#sf-popup .sfemail" ).keyup(function() {
var $email = this.value;
validateEmail($email);
function validateEmail(email) {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (!emailReg.test(email)) {
$('#sfpsubmit').attr('disabled','disabled');
} else {
$('#sfpsubmit').removeAttr('disabled');
}
}
});
});