Pages

Custom HTML5 Validation Message 0 Javascript

Change HTML5 validation error message and add a customize validation. This is easy and no need to write java script separately. See the example for a select list highlighted area.


<select
 class="form-control" 
id="priceselect"
 required="" 
 oninvalid="this.setCustomValidity('Please select Portion Size')" 
oninput="setCustomValidity('')"
 title="Please select Portion Size">
<option value="">-- Please Select Portion Size --</option>
</select>

<select
 class="form-control" 
id="priceselect"
 required="" 
 oninvalid="this.setCustomValidity('Please select Portion Size')" 
oninput="setCustomValidity('')"
 title="Please select Portion Size">

<option value="">-- Please Select Portion Size --</option>

</select>

No comments:

Post a Comment

Search This Blog