HTML <select> with name Attribute

You are Here:

HTML <select> with name Attribute

The name attribute specifies the name for the drop-down list.

The name attribute is used to get the selected option in the drop-down list by using JavaScript.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <h2>Choose Your Favourite Fruit.</h2> <form action="/fruits.php"> <select name="myFruit" required> <option>Apple</option> <option>Banana</option> <option>Cherry</option> <option>Dates</option> </select> <button type="submit">Submit</button> </form> </body> </html>

Attribute Value

ValueExplanation
textSpecifies the name for the drop down list.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author