YouTip LogoYouTip

Att Select Name

# HTML ` tag is used to define a name for a drop-down list. This name acts as an identifier when submitting form data to a server or when referencing the element via JavaScript. --- ## Definition and Usage The `name` attribute is crucial when working with HTML forms. * **Form Submission:** When a form is submitted, the data from the drop-down list is sent to the server as a key-value pair: `name=value` (where `name` is the value of the `` element does not have a `name` attribute specified, its selected value will **not** be sent to the server upon form submission. --- ## Browser Support The `name` attribute is fully supported by all major modern web browsers: * Google Chrome * Mozilla Firefox * Microsoft Edge / Internet Explorer * Safari * Opera --- ## Syntax ```html ``` ### Example 2: Accessing the Element via JavaScript You can use the `name` attribute to easily access the drop-down list using JavaScript's `document.forms` API. ```html
``` --- ## HTML 4.01 vs. HTML5 There are no differences in the behavior or support of the `name` attribute for the `` element has the `multiple` attribute enabled, the browser will send multiple key-value pairs with the same name to the server (e.g., `cars=volvo&cars=audi`). Depending on your backend language (like PHP), you may need to use array notation in the name attribute, such as `name="cars[]"`.
← Att Select RequiredAtt Select Multiple β†’