bootstrap 4 select validate code example
Example 1: bootstrap form input select
<div class="col-lg-6 col-md-6 col-12">
<div class="input-group mb-3">
<div class="input-group-prepend">
<select class="form-control select2bs4" name="country_code" id="country_code" style="width: 100%">
<option value="+91">+91</option>
<option value="+351">+351</option>
<option value="+1">+1</option>
</select>
</div>
<input type="text" name="user" class="form-control" placeholder="Email Or Mobile Number">
</div>
</div>
Example 2: check if form bootstrap is valid js
function form_validate(attr_id){
var result = true;
$('#'+attr_id).validator('validate');
$('#'+attr_id+' .form-group').each(function(){
if($(this).hasClass('has-error')){
result = false;
return false;
}
});
return result;
}