I want to change my checkbox required default message.
I am trying with this code but if I check my checkbox then it still shows required message.
my code
<input required type="checkbox" name="rcheck2"
oninvalid="this.setCustomValidity('check plz')" oninput="setCustomValidity('')" />
https://jsfiddle.net/6ekk9upz/
checkbox inputs don't have the oninput
event, they have the onchange
event.
Check this:
<form action="" name="formReg" id="formReg" method="post" class="formReg">
<div class="checkTxt">
<input required type="checkbox" name="rcheck1" oninvalid="this.setCustomValidity('check plz')" onchange="this.setCustomValidity('')"/>
</div>
<div class="checkTxt">
<input required type="checkbox" name="rcheck2" oninvalid="this.setCustomValidity('check plz')" onchange="this.setCustomValidity('')"/>
</div>
<div class="checkTxt">
<input required type="checkbox" name="rcheck3" oninvalid="this.setCustomValidity('check plz')" onchange="this.setCustomValidity('')"/>
</div>
<input type="submit" name="btnReg" value="Submite"/>
</form>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With