I have the following code;
function checkemail()
{
var email=document.getElementById( "emailReg" ).value;
if(email)
{
$.ajax({
type: 'post',
url: 'check_email.php',
data: {
user_email:email,
},
success: function (response) {
$( '#confirmUsername' ).html(response);
if(response=="OK")
{
$('#ResetSubmit').attr('disabled','');
return true;
}
else
{
$('#ResetSubmit').attr('disabled','disabled');
return false;
}
}
});
}
else
{
$( '#confirmUsername' ).html("");
return false;
}
}
with this function I can check in an event onkeyup()
in the input of my form
<input type="email" class="form-control" name="emailReg" id="emailReg" onkeyup="checkemail()" ?>"required>
With which I can correctly validate whether or not the mail to be checked exists, my problem currently resides in this code event is that I have problems
if(response=="OK")
{
$('#ResetSubmit').attr('disabled','');
return true;
}
else
{
$('#ResetSubmit').attr('disabled','disabled');
return false;
}
Achieve perfectly disable my submit button but if the event is true I can not disable it.