Run
Online Code Editor
It is an example of using the andSelf() method.
div
Paragraph 1
Paragraph 2
Paragraph 3
Click the below button to see the effect.
Click me
Here, we can see that the paragraph 1 is also selected. This is due to the andSelf() method. If we do not use it, only 2nd and 3rd paragraphs will get selected.