global attributes in html5

In HTML5, a new concept of "global attribute" is added. The so-called global attribute refers to an attribute that can be used for any attribute. Commonly used global properties are listed below.

1. The contentEditable property is developed by Microsoft. The main function of this property is to allow users to edit the content in the element, so the property must be an element that can get the mouse focus, and after clicking the mouse, a caret must be provided to the user to prompt the user The content of this element allows editing. This property is a boolean property that can be specified as true or false. Note: After editing the content of an element, if you want to save the content, you can only send the innerHTML of the element to the server for saving, because the innerHTML of the element will also change after the content of the element is changed. There is no specific API yet to save the content of the edited element.

2. The designMode attribute is used to specify whether the entire page can be edited. When the page is editable, any elements in the page that support contentEditable become editable. The designMode property can only be edited in Javascript scripts. This property has two values ​​"on" and "off", use javascript to specify the method of the designMode property: document.designMode="on"

3, hidden attribute, all elements are allowed to use a hidden attribute, the function is to inform the browser not to render the element, making the element invisible. However, the content in the element is still created by the browser, which means that javascript script is allowed to cancel the attribute after the page is loaded. The hidden property is a boolean property.

4. The spellcheck attribute is a new attribute provided by the two text input boxes input and textarea. The function is to check the spelling and grammar of the text input by the user. The spellcheck property is a boolean property.

5, tabindex attribute

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325065532&siteId=291194637