jQuery end: Main Tips
.end()method is useful when you're using chaining.
- The jQuery
.end()finishes the most recent filtering operation in the chain.
.end()method returns the original set of elements you had before manipulating the chain.
Usage and Syntax of .end()
If you use .find() or another filtering function on an jQuery chain, a newly wrapped element set is returned. jQuery
.end() method concludes the filtering and returns to the original set of elements (before the execution of the first function).
.end() function takes no arguments.
$( "ul.list-1" ) .find( ".demo" ) .css( "background-color", "lightgreen") .end() .find( ".demo-bar" ) .css( "background-color", "orange" );
Latest Coupon Found:
TOP-RATED CODING COURSES
Learn the skills of tomorrow
The best time to learn programming is now - follow this link to access 100+ coding courses and enjoy learning at a very low cost!