has
?? [h?z] ??? [h?z]
v.Have (have? 3?? ??) accept;
jquery has() ??? ???
??: has()? ???? ?? ??? ??? ??? ?? DOM ??? ???? ?? ??? ?? ?? ???? ????.
??: ??.has(selector)
????:
???? | Description |
??? ?, ???? ??? ??? ?? ??. |
DOM ?? ???? ???? jQuery ??? ?? ?? .has() ???? ???? ??? ?? ??? ???? ? jQuery ??? ?????. ??? ???? ???? ??? ?? ??? ???? ? ?????. ?? ??? ???? ???? ?? ??? ??? ?????.
jquery has() ??? ?
<!DOCTYPE html> <html> <head> <style> .full { border: 1px solid red; } </style> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <ul><li>Does the UL contain an LI?</li></ul> <script> $("ul").append("<li>" + ($("ul").has("li").length ? "Yes" : "No") + "</li>"); $("ul").has("li").addClass("full"); </script> </body> </html>
??? ????? ??? "???? ??" ??? ?????