I am trying to do an inline validation, it worked with alert but we need error message to appear on top of submit button not an alert box.
JS Function
function validateEmail(username) {
var reg = /^([A-Za-z0-9_-.])+@([A-Za-z0-9_-.])+.([A-Za-z]{2,4})$/;
if (reg.test(username.value) !== false) {
$("#msgbox").fadeTo(200,0.1,function() {
//add message and change the class of the box and start fading
$(this).html('Invalid username / password...').addClass('messageboxerror').fadeTo(900,1);
});
}
return false;
}