miket-dev / multiselect

Pure js multiselect implementation
MIT License
38 stars 30 forks source link

required attribute not validating the data #8

Open ambatidilip opened 4 years ago

ambatidilip commented 4 years ago

When i give required to the select html attribute and applied plugin, its not capturing the select name attribute and not displaying error message if you haven't selected any value.

Ex:

<select id="someId" name="someName" required>
<option>....</option>
</select>

<div id="errors">
Select at least one hobbies
</div>

on HttpPost someName is empty

M-Kamel commented 3 years ago

you can use this code $('.multiselect-input').attr('required', 'required');