Skip to content
Related Articles

Related Articles

HTML | <select> form Attribute
  • Last Updated : 30 May, 2019

The HTML <select> form Attribute is used to specify the one or more forms that the <select> element belongs to.

Syntax:

<select form="form_id"> 

Attribute Values:

  • form_id: It Contains the value i.e form_id which specify the one or more than the select element belongs to. The value of this attribute should be id of the <form> element.

Example:




<!DOCTYPE html>
<html>
  
<head>
    <title>select Form Attribute</title>
    <style>
        h1,
        h2,
        .titl {
            text-align: center;
        }
          
        fieldset {
            width: 50%;
            margin-left: 22%;
        }
          
        h1 {
            color: green;
        }
    </style>
</head>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <h2><select> form Attribute</h2
      Select your preferred course from the drop-down list:
        <br>
  
        <select form="myGeeks" id="myCourses" autofocus>
            <option value="C++">c++</option>
            <option value="Placement">Placement</option>
            <option value="Java">Java</option>
            <option value="Python">Python</option>
        </select>
        <br>
        <form id="myGeeks">
            <input type="submit">
        </form>
    </center>
</body>
  
</html>

Output:

Supported Browsers: The browser supported by HTML <select>form Attribute are listed below:

  • Google Chrome
  • Internet Explorer 10.0 +
  • Firefox
  • Opera
  • Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :