【JS】Intermediate7:jQuery:DOM API

1.jQuery also makes performing actions on many elements at the same time simple

2.eg:$('.note').css('background', 'red').height(100);
$('.note') selects all the elements with a class of note on the page and then we set the background of all of the note boxes to red and their heights to 100px.

3.Getters and setters

4.Context

limit the area(context) of the DOM from which an element can be selected

second argument :DOM element, a string selector (selecting an element that jQuery will find and use) or a jQuery object

eg:var $headerBoxes = $('.note', $header);

the variables that are used to store jQuery objects begin with a dollar

原文地址:https://www.cnblogs.com/yzhen/p/3664447.html