Question

I am using jQuery validationEngine.js plugin for validating input fields. It requires me to add a class="validate[required] text-input" so it can validate when submit the form. But I have class="form-control" and, due to this, the validation is not working. If I remove class="form-control" validation will work but input box will be misaligned. Is there any way I can keep both? Or any other solution for this problem ? Thanks!

<input 
  name="selectAgent" 
  type="text" 
  class="form-control" 
  id="selectAgent" 
  class="validate[required] text-input" 
>
Was it helpful?

Solution

Add all your classes at once. Having two class declarations can cause an error.

Use (notice how form-control is added to the end of your class with a space that is how you can add another class)

<input 
  name="selectAgent" 
  type="text" 
  id="selectAgent" 
  class="validate[required] text-input form-control" 
>

Instead of

<input 
  name="selectAgent" 
  type="text" 
  class="form-control" 
  id="selectAgent" 
  class="validate[required] text-input" 
>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top