wrap
English[r?p] US[r?p]
vt. Wrap; ?(?? ?, ?? ?)... , ??, ???; vi. ??, ??(?? over, around ?? ?? ???); ???, ???(? ?)
all?? [ ?:l] 美[?l] adj. ?? ?, ?? ??, ??? ??
pron.?? ?, ?? ?, ?? ??
adv.???;?? ?;??
n.???; -]??;[?? my, your, his, her ?? ?? ???] (????) ??? ?? ?? ?
jquery WrapAll() ??? ???
??: wrapAll()? ??? ?? ??? ????? HTML ??? ?? ??? ?????.
??: ??$(selector).wrapAll(wrapper)
????:
Parameters | Description |
wrapper | ?????. ??? ??? ???? ???? ?????. ??? ?: HTML ?? - ?: ("<div></div>") ? DOM ?? - ?: (document.createElement("div")) ?? ?? - ?: ($(".div1" )) ????? ??? ??? ?? ???? ?? ? ?????. |
jquery WrapAll() ??? ?
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".btn1").click(function(){ $("p").wrapAll("<div></div>"); }); }); </script> <style type="text/css"> div{background-color:yellow;} </style> </head> <body> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button class="btn1">用一個 div 包裹所有段落</button> </body> </html>
??? ????? ??? "???? ??" ??? ?????