Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the newly added attributes in html5

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the newly added attributes in html5, which have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

New attributes added to html5 are: placeholder, calendar, Draggable, autocomplete, novalidate, autofocus, override, list, multiple, pattern, required, and so on.

The operating environment of this tutorial: windows7 system, HTML5 version, Dell G3 computer.

New properties in html5

Placeholder

Calendar

ContentEditable (to describe whether the content in the tag is editable)

Draggable

Hidden

Context-menu

Data-val (Custom attribute)

Autocomplete

Novalidate

Autofocus

Override

List

Multiple

Pattern

Required

Two new form properties, autocomplete and novalidate, are added to html5

1.autocomplete attribute

This property is used to control whether the autocomplete function is turned on and off. You can set a form or input element with two attribute values, which are enabled when set to on and turned off when off is set. When this feature is enabled, the browser displays the filled options in the field when the user starts typing in the field automatically. Each time the user submits, an option is added for selection

Please enter:

2.novalidate attribute

The input input type, which is validated when the form is submitted. The novalidate attribute is used not to validate form or input when the form is submitted:

E-mail:

New input property

1.autofocus attribute

The autofocus property is used to automatically get focus.

2.form attribute

The form attribute is used to set which form the input element belongs to. In html4, all elements in the form must be between the start and end tags of the form, while in html5, if you want to attribute elements other than the form's start and end tags to the form, you only need to set the form attribute

Common address: temporary address:

When setting the form property, you need to know the value of the id property of the form, and set the value of the form property to the property value of the form id.

3. Form rewrite property override

The override attribute is used to override some properties of a form element. In html5, the form properties that can be overridden are formaction, formmethod, formenctype, formnovalidate, and formtarget, which are used to override the action, enctype, method, novalidate, and target properties of the form, respectively.

User name:

The first input element submits the entered data to the a.jsp page, while the second input element sets the formaction attribute, overrides the action attribute, and sets the submission page to the b.jsp page

4.list attribute:

The list attribute is used to set the datalist element of the input field, the id attribute value of datalist is set for the list attribute, and the datalist element can be associated with the input element:

6.2.1

5.multiple attribute

The multiple attribute is used to set whether the input element can have multiple values. This attribute applies only to input elements of email and file types. If you set the multiple attribute on an input element of type email, you can enter multiple email addresses in the input box, separated by commas between multiple email addresses.

If you set the multiple attribute to the input element of type file, you can select a file in the open Select File dialog box.

E-mail:File:

6.pattern regular expression

A regular expression consists of a series of characters and numbers used to match a syntactic rule. This attribute applies to input elements of text, search, url, telephone, email and password types

Start with a letter, 6-16 digits

7. Set the prompt message and the placeholder attribute of the input element when the content is empty

When there is a text input box on the page, but you don't know what to type.

8. Remind required property when submission is empty

Users must fill in the content before they can submit it. If it is empty, it will not be submitted.

Thank you for reading this article carefully. I hope the article "what are the newly added attributes in html5" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report