can we apply required attribute to checkbox in html multiple checkbox?without use of javascript or jquery
I want to apply validation to html page without javascript.and warning message also be shown.answer don't contain any type of function etc.
On
Yes, you can apply the required attribute to a checkbox in HTML, even when you have multiple checkboxes.
<form>
<div>
<label><input type="checkbox" name="option" value="option1" required> Option 1</label>
</div>
<div>
<label><input type="checkbox" name="option" value="option2" required> Option 2</label>
</div>
<div>
<label><input type="checkbox" name="option" value="option3" required> Option 3</label>
</div>
<div>
<label><input type="checkbox" name="option" value="option4" required> Option 4</label>
</div>
<input type="submit" value="Submit">
</form>
I'm pretty sure it can be done with:
This will automatically give an error popup message if the checkbox is not filled in.