and
英[ənd] 美[ənd, ən,ænd]
conj.And; and, with; so, then; therefore
self
英[self] 美[sɛlf]
n.Oneself;oneself;nature;self-interest
adj.unified; pure; single
vt. To self-fertilize; to cause inbreeding
vi. To self-fertilize
jquery andSelf() method syntax
Function: add() method adds the previous set of elements in the stack to the current set.
Syntax: .andSelf()
jquery andSelf() method example
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <style> p, div { margin:5px; padding:5px; } .border { border: 2px solid red; } .background { background:yellow; } </style> </head> <body> <div> <p>First Paragraph</p> <p>Second Paragraph</p> </div> <script> $("div").find("p").andSelf().addClass("border"); $("div").find("p").addClass("background"); </script> </body> </html>
Click the "Run instance" button to view the online instance