- Modify styles through JS: the styles modified by this method are inline styles with high priority. However, if “! Important” is used in the style, the modification of JS will not work.
Syntax: element.style.styleName = styleValue ; The style value must be a string Note: If the style of css contains " - " , this name is not legal in JS, you need to change this style name to camel naming, remove the " - " and change the initial letter to uppercase.
The styles set and read through the style property are inline styles
- get the display style of the current element:
Syntax: element.currentStyle.styleName currentStyle is only supported by IE browser
In other browsers, you can use the getcomputedstyle() method to get the current style of the element. This method is a window method and can be used directly. This method will return a style object that encapsulates the corresponding style of the current element.
Two parameters are required The first: the element to get the style The second: you can pass a pseudo-element, which is usually null
Note: the styles obtained through currentstyle and getcomputestyle are read-only and cannot be modified. If you want to modify them, you must use the style property </OL> to modify them
- The solution to the problem that the custom styles of UI components such as element-ui in the vue project do not take effect
- Solution to build error in Vue project (error in static/JS)/vendor.xxxxx.js from UglifyJs）
- JS uses onerror to automatically catch exceptions
- How to introduce iconfont into uni-app
- CSS to achieve dynamic display of picture text by mouse touch
- Method of adding operation button for each line of data in DataGrid of easyUI
- Module build failed: Error: Couldn’t find preset “es2015” relative to directory
- JS bug Log Uncaught TypeError: Cannot read property ‘previoustSibling‘ of null
- Vue elementui: solution for error: avoided redundant navigation to current location: “/xxx”
- How to open a page in a new window by Vue router
- Asynchronous loading method of Baidu map
- Difference between innerHTML and innerText
- The addition, deletion and modification of DOM in JS Foundation
- Localstorage sets the expiration time.
- Vue refreshes the current page (no flash screen will appear)
- Please transfer a valid prop path to form item
- Error: Computed property “menuList” was assigned to but it has no setter.
- How to Test whether the property value of each property in the object is not empty
- How to Block a frame with origin from accessing a cross origin frame
- If the request parameter is formdata, use the Ajax operation