First, Jqury element property operation
jquery allows you to manipulate the attributes of the element itself, including getting property values for properties, setting property values for properties, and deleting attribute values (attr () and Removeattr ()).
Ii. jquery style operation
Element style actions include: setting CSS styles directly, adding CSS styles, category switching, and deleting categories.
For example:
$ (' div '). css (' color ');//Gets the CSS style color within the line of the element.
$ (' div '). css (' color '). ' Pink ');//Set my favorite pink.
var box = $ (' div '). css ([' Color ', ' height ', ' width ']);//This gets an array of objects.
By the way, the traversal of the array: two methods
First Kind
for (var i in box) {
Box[i];
}
The second Kind
$.each (Box,function (attr,value) {//Traverse JavaScript Primitive Ecological objects
attr+ ":" +value;
})
Define multiple styles for a div:
div style Click to toggle:
Iii. Introduction to JQuery Dom
In jquery, the most common dom manipulation methods have been encapsulated (without regard to browser compatibility).
D denotes document for the page
o represents an object, a set of data that contains independent attributes
M represents the model, which is the element nodes and text nodes on the page.
Dom has three forms, the standard DOM, Htmldom, and Cssdom, which do not need to be understood at this moment.
The tree structure used to represent the DOM is very pertinent. Most operations are element node operations, and a small number of text node operations.
Iv. Setting element content
jquery element properties and style actions, and setting elements and content