סלקטור צאצא
תיאור: בוחר כל האלמנטים שהם צאצאיהם של אב קדמון מסוים.
jQuery('ancestor descendant')
הוספה בגרסה: 1.0
ancestor
כל סלקטור חוקי.
descendant
סלקטור עבור סינון אלמנטים צאצא.
צאצא של אלמנט יכול להיות ילד, נכד, וכן הלאה, של האלמנט.
דוגמאות
מחפש כל הצאצאים שדה מסוג input של תווניות.קוד מלא:
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $("form input").css("border", "2px dotted blue"); }); </script> <style> body { font-size:14px; } form { border:2px green solid; padding:2px; margin:0; background:#efe; } div { color:red; } fieldset { margin:1px; padding:3px; } </style> </head> <body> <form> <div>Form is surrounded by the green outline</div> <label>Child:</label> <input name="name" /> <fieldset> <label>Grandchild:</label> <input name="newsletter" /> </fieldset> </form> Sibling to form: <input name="none" /> </body> </html>
האם מידע זה היה מועיל?

