The example in this article describes the usage of the get() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:
This method can return an array of all DOM elements in the matching collection or a DOM element with a specified index.
Index values start from 0.
Description: As can be seen from the above definition, this method can convert jQuery objects into DOM objects.
Grammar structure 1:
Without parameters, an array of all matching DOM elements will be obtained.
Example code:
By using $(".zhuanqu").get(), you can get the array of li elements with the class name zhuanqu. After reading the example, you may ask why $() is needed outside. This is because the DOM object obtained through the get() method needs to be converted into a jQuery object before the CSS() method can be used.
Grammar structure 2:
With parameters, obtains a specified matching element in the array of all matching DOM elements.
Example code:
里面的参数是要获取的DOM对象数组中DOM对象的索引,索引是从零开始的。
希望本文所述对大家的jQuery程序设计有所帮助。