我希望将regis.checksum转换为1,以便下一次block不会运行。我也是新来的stackoverflow。在此先感谢了help`JavaScript对象变量不会改变
var regis = {
checksum : 0,
username : false,
first_name : false,
password : false,
password_check : false
}
if($("#id_username").val().trim() == ""){
if(regis['checksum']==0){
alert(regis.checksum)
$("#id_username").focus(function(){
$("#error_username").text("Your email id will be created with this name");
regis['checksum'] = 1
})
}else{
$("#id_username").on('input', function() {
alert("Change to " + this.value);
});
}
}`
有啥问题? –
@Yogesh regis.checksum只改变本地范围的值,但我希望它改变全球regis.checksum –
是你的'regis'对象在文档准备好之外声明吗? –