Search code examples
jqueryhtmljqbootstrapvalidation

"required" attribute does not work properly in SAFARI browser


I have used bootstrap form validation but it doesn't work in safari browser. When I select first option and submit but it remain disabled, but when select the second option then it work well and removed the disabled. Please help me....My code is here...


<select name="gender" class="form-control" required="true">
  <option value="">Select Gender</option>
  <option value="Male">Male</option>
  <option value="Female">Female</option>
</select>


Solution

  • The only way you can guarantee client side form validation in safari is to use javascript.

    Safari doesn't support the required html attribute completely.

    That said, it's not a bad idea anyway to have a separate layer for client side validation that isn't baked into bootstrap. If you bind to the form submit event it's pretty easy to loop through the fields and do your own assessment.