Jquery Form Validation Error div position in select fields [closed]

1

How to change the position of error text in select2 fields. is popping up on the field, I want it to appear below! Any tips?

<!--/field--><divclass="col-md-3">
<div class="form-group">
<label class="control-label">SEXO
<span class="required"> * </span>
</label>

<select name="sexo" id="sexo" class="form-control select2" tabindex="9" required>

<? 
if($Obj->sexo=="F") $sexo = "Feminino"; 
if($Obj->sexo=="M") $sexo = "Masculino";
?>

<optgroup label="">
<option value="<?=$Obj->sexo?>" selected > <?=$sexo?> </option>
</optgroup>

<optgroup label="...">
<option value="F">Feminino  </option>       
<option value="M">Masculino </option>       
</optgroup>
</select>

</div>
</div>
<!-- /field -->



<!-- field -->
<div class="col-md-6">
<div class="form-group">
<label class="control-label">NOME COMPLETO
<span class="required"> * </span>
</label>

<div class="input-icon right"><i class="fa"></i>
<input type="text" autofocus onfocus="select(this);" id="nomecompleto" name="nomecompleto" minlength="3" maxlength="150" class="form-control jump" 
    value="<?=htmlspecialchars($Obj->nomecompleto)?>" required tabindex="2">
</div></div>
</div>
<!-- /field -->
    
asked by anonymous 16.10.2017 / 13:36

1 answer

1

I was able to resolve.

Within the js file that has the function of form validation has the option of errorplacement , then it was only create the element after finding the element with the desired class. It worked 100%.

if (element.parent(".form-group").size() > 0) {
  error.insertAfter(element.next('.select2'));
}
    
16.10.2017 / 17:27