What are the new attributes provided in HTML5 for input tag?

0

Following are the new attributes provided in HTML5 for

1) autofocus:

- This is a Boolean attribute.

- When present, it means that an element should automatically get focus when the page is loaded.

2) form:

- This attribute specifies one or more forms an element belongs to.

3) formaction:

- This attribute specifies the URL of a file that will process the input control when the form is submitted.

- This attribute is used with type="submit" and type="image".

- It overrides the action attribute of the

element.

4) formenctype:

- This attribute specifies how the form-data should be encoded when submitting it to the server.

- It is used with type="submit" and type="image".

- It overrides the enctype attribute of the element.

5) formmethod:

- It defines the HTTP method for sending form-data to the action URL.

- It is used with type="submit" and type="image".

- It overrides the method attribute of the element.

6) formnovalidate:

- It is a boolean attribute.

- It specifies that the element should not be validated when submitted.

- It is used with type="submit".

- It overrides the novalidate attribute of the element.

7) formtarget:

- It specifies a name or a keyword that indicates where to display the response that is received after submitting the form.

- It is used with type="submit" and type="image".

8) height and width:

- It specifies the height and width of an element.

- It is used only with

9) list:

- It refers to a element which contains pre-defined options for an element.

10) min and max:

- It specifies the minimum and maximum value for an element.

- It works with the following input types: number, range, date, datetime, datetime-local, month, time and week.

11) Multiple:

- It is a boolean attribute.

- It specifies that the user is allowed to enter more than one value in the element.

- It works with the following input types: email and file.

12) pattern:

- It specifies a regular expression that the element's value is checked against.

- It works with the following input types: text, search, url, tel, email, and password.

13) placeholder:

- It specifies a short hint that describes the expected value of an input field.

- It works with the following input types: text, search, url, tel, email, and password.

14) required:

- It is a boolean attribute.

- It specifies that an input field must be filled out before submitting the form.

15) step:

- It specifies the legal number intervals for an element.

- It works with the following input types: number, range, date, datetime, datetime-local, month, time and week.

asked Apr 15, 2023 at 00:24
Sign in to add a comment

0 Answers

0
📝 No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.