HTML <option> with label Attribute

HTML <option> with label Attribute

The label attribute indicates the meaning of the <option> element text content.

If the label attribute is not defined, its value is that of the element text content.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/fruits.php" method="get"> <select name="myFruit"> <option label="Apple">Red(color)</option> <option label="Banana">Yellow(color)</option> <option label="Sapodilla">Brown(color)</option> </select> <button type="submit">Button</button> </form> </body> </html>

Attribute Value

ValueExplanation
textIndicates the meaning of the option. If it is not defined, its value is that of the element text content.

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.

Meet the Author