I have written this script to fade in/out an error container. it works fine in FF and Chrome but does not work at all in IE8.
You can play with the fiddle here: http://jsfiddle.net/mostafatalebi/8tw2x/
or look the below code:
Here is the Container CSS:
.error-box
{
filter:inherit;
width: auto;
display: inline;
padding: 5px;
border-radius: 5px;
-webki-border-radius: 5px;
-moz-border-radius: 5px;
direction: rtl;
text-align: right;
background-color: #C00;
color: white;
font-size: 13px;
width: 200px;
float: left;
margin-bottom: 5px;
opacity:inherit;
filter:inherit;
}
Here is the HTML DOM:
<label class="form-label">Email</label><br />
<div class="form-field-holder">
<input id='email' type="text" name="email" class="form-input" />
<div class="error-box"><!-- jQuery --></div><br />
</div>
And here is the jQuery code to handle the process:
$(document).ready(function(e) {
var email = $("#email");
email.on('blur', function(){
console.log(email_regexp.test(email.val()));
if(!email_regexp.test(email.val()))
{
$(this).siblings('.error-box').fadeIn(600).text("رایانامه شما اشتباه است");
}
else
{
$(this).siblings('.error-box').fadeOut(600);
}
});
});