Whenever a user focuses out of a textbox, I am checking if the email address is already registered. If it's not registered, I want to display a checkmark symbol (the correct Font Awesome symbol) on the right side of the text box. If it is registered, then I want to show a cross symbol.
This is what I have tried:
HTML
<div class="col-md-6 col-lg-6">
<input type="text" name="user.mailId" id="mailid" placeholder="Mail Id" class="form-control rgn"/>
</div>
JQuery
$(document).on('focusout', '#mailid', function (event) {
$('#mailid').addClass('availablle');
});
CSS
.availablle {
position:relative;
}
.available:before {
content: "";
font-family: FontAwesome;
left:-5px;
position:absolute;
top:0;
color:green;
}
You can find my code here. I found guidance from this source.