I want to clear the email input box when function(data)
is greater than zero. The user will have to be force to re-enter another email address since the form will not submit if any fields are blank. how would I clear out the input box?
javascript:
$("#email").change(function(){
var email=$("#email").val();
$.ajax({
type:"post",
url:"/files/reg_check.php",
data:"email="+email,
success:function(data){
if(data == 0){
$("#email_msg").html("E-mail Address must be valid");
} else {
$("#email_msg").html("<div class='msg_check_red'>Error: E-mail address already in use.</div>");
}
}
});
});
html:
<label>E-mail:</label>
<input type="email" placeholder="your@email.com" id="email" name="add[email]" size="20" title="A valid email address required" class="{validate:{required:true,email:true}}" />
<span class="rsmall"><div id="email_msg">E-mail Address must be valid</div></span><br />