1) Get the DOM element ID and CSS attributes
Dom is the HTML node. Javascript operates these nodes to achieve website dynamics.
The original W3C also provides node access operations, but it is not very useful.
Direct access to ID nodes
$ ('# Elementid ')
2) Modify CSS attributes
The CSS attribute corresponds to a class in HTML. The value of each class must be consistent with a value in the CSS list so that the webpage can be correctly displayed. Javascript is used to modify the values of these classes, to dynamically change the website content.
Get Style
((Element).css ('prop ')
Modify Style
((Element).css ('prop', 'value ')
((Element).css ({prop: 'value', prop2: 'value2 '})
3) Common HTML operations
Update all elements
((Element).html ("<p> Hello </P> ")
$ (Element). Text ("<p> Hello </P> ")
Inject other content into the element
$ (Element). Before ("<p> Hello </P> ")
$ (Element). prepend ("<p> Hello </P> ")
$ (Element). append ("<p> Hello </P> ")
$ (Element). After ("<p> Hello </P> ")
4) Dom loading and window onload
It is generally considered that Dom loading is faster, but in some cases it is not loaded using Windows. For example, you need to wait until the image is loaded to know the size of the image.
In HTML:
<Body onload ="
Sometriccriptcode">
In javascript:
Window. onload = function (){
Sometriccriptcode};
5) Listen to events
There are many events. jquery uses bind and unbind to listen to a certain element.
This part is not carefully read, but it is basically all about jquery. You need to carefully read the following jqeury-related content in the future.