0
How to change the message below and stay with the simplicity and coherence I need?
I have the following code:
$(function() {
var requiredCheckboxes = $('.periodicidade :checkbox[required]');
requiredCheckboxes.change(function() {
if (requiredCheckboxes.is(':checked')) {
requiredCheckboxes.removeAttr('required');
}
else {
requiredCheckboxes.attr('required', 'required');
}
});
});
<div class="periodicidade">
<input type="checkbox" required value=1>Segunda-feira
<input type="checkbox" required value=2>Terça-feira
<input type="checkbox" required value=3>Quarta-feira
<input type="checkbox" required value=4>Quinta-feira
<input type="checkbox" required value=5>Sexta-feira
<input type="checkbox" required value=6>Sábado
<input type="checkbox" required value=7>Domingo
</div>
Remarks:
- Mandatory marking of at least 1 (a)
checkbox
- Utilise
setCustomValidity
for the modification of the message