What is the use of end() in jQuery?
<ul id="l"><li class="a">A</li><li class="b">B</li></ul>
$('#l')
.find('.a').addClass('first')
.end()
.find('.b').addClass('second');
HTML after the code runs
<ul id="l">
<li class="a first">A</li>
<li class="b second">B</li>
</ul>
See Method Chaining.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |