Home  >  Article  >  Web Front-end  >  Usage of end method in jQuery

Usage of end method in jQuery

巴扎黑
巴扎黑Original
2017-06-24 11:14:512198browse

When we use find, filter and other methods on the result set, the result set will be changed.

This method of changing the original result set is called destructive jQuery method

jQuery cookbook has the following definition:

A destructive operation is any operation that changes the set of matched jQuery elements, which means any traversing or manipulation method that returns a jQuery object, includingadd() , andSelf(), children(), closes(), filter(), find(), map(), next(), nextAll(), not(), parent(), parents(), prev(), prevAll(), siblings(), slice(), clone(), appendTo(), prependTo(), insertBefore(), insertAfter(), replaceAll().

The specific usage is as follows




	

Text

Middle Text

Text

When executing filter('.middle') on the result of $('p') , only 7c61ad4612246177aec1482cc8266012Middle 45a2772a6b6107b401db3c9b82c049c2Text54bdf357c58b8a65c66d7c19c8e4d11494b3e26ee717c64999d7867364b1b4a3 matches the result.

Continue to perform the above operation end(), then the effect of filter() will be undone, and the result set will contain three e388a4556c0f65e1904146cc1a846bee

The above is the detailed content of Usage of end method in jQuery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn