and
英 [?nd]? ?美 [?nd, ?n,?nd]??
conj.而且;和,與;于是,然后;因此
self
英 [self]? ?美 [s?lf]??
n.自己;本人;本性;私利
adj.同一的;純凈的;單一的
vt.使自花授精;使近親繁殖
vi.自花授精
jquery andSelf() 方法 語法
作用:add() 方法把堆棧中之前的元素集添加到當前集合。
語法:.andSelf()
jquery andSelf() 方法 示例
<!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>
點擊 "運行實例" 按鈕查看在線實例