html
<div class="form-group">
<input id="register-username" class="input-material" type="email" name="registerUsername" placeholder="请输入邮箱" >
<div class="invalid-feedback">
请输入正确的邮箱格式
</div>
</div>
js部分。记得引用jquery.js文件
$("#register-username").change(function(){
name=$("#register-username").val();
var re=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
if(!re.test(name)){
$("#register-username").removeClass("form-control is-valid")
$("#register-username").addClass("form-control is-invalid");
flagName=false;
}else{
$("#register-username").removeClass("form-control is-invalid")
$("#register-username").addClass("form-control is-valid");
flagName=true;
}
})