简体   繁体   中英

Usage of type attribute in HTML5

  <body>
    <form action="Welcome.html" method="get" id="user_id">
        <input type="submit" formmethod="post" value="post method submit"/> </br>
    <input type="submit" formtarget="_blank" value="opens in new window"/> </br>
    </form>
</body>
</html>

In the above code , they have used type="submit" . Is this "submit" a predefined one or it can be anything. Can I also use type="pradeeba" (user defined attribute).

And second query is on value attribute. For certain tags i could find that value is mentioned whereas in certain places value is not metioned. Is value a mandatory attribut for every input type.

Pls help on the two queries.

submit is a predefined type.

Per the W3C http://dev.w3.org/html5/markup/input.html :

input type=text
input type=password
input type=checkbox
input type=radio
input type=button
input type=submit
input type=reset
input type=file
input type=hidden
input type=image
input type=datetime
input type=datetime-local
input type=date
input type=month
input type=time
input type=week
input type=number
input type=range
input type=email
input type=url
input type=search
input type=tel
input type=color

type="pradeeba" will render as a type="text" element in all browsers I'm aware of.

Value attribute specifies the initial value of the control. It is optional.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM