hi i have a select(dropdown button) which displays various chioce for the user to select .. i want to validate it that if the user does not select any choice i should not able to do any action how to do. Is there any like required available for text box in html
Jump to Post
You can use the
<form method="post" action=""> <label for="fruits">Choose an option:</label> <select name="fruits" required> <option value="">------</option> <option value="fujiapple">Apple</option> <option value="vanillaorange">Orange</option> <option value="pandoracherry">Cherries</option> </select> <input type="submit" name="submit" value="submit" /> </form>
By adding an empty option the form will not be submitted. You could …
All 2 Replies
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.