1 line
1.7 KiB
JSON
1 line
1.7 KiB
JSON
{"name":"next siblings","type":"selector","title":"Next Siblings Selector (\"prev ~ siblings\")","deprecated":null,"removed":null,"desc":"Selects all sibling elements that follow after the \"prev\" element, have the same parent, and match the filtering \"siblings\" selector.","categories":["selectors/hierarchy-selectors","version/1.0"],"entries":[{"return":"","signatures":{"added":"1.0","argument":[{"desc":"Any valid selector.","name":"prev","type":"Selector"},{"desc":"A selector to filter elements that are the following siblings of the first selector.","name":"siblings","type":"Selector"}]},"examples":{"desc":"Finds all divs that are siblings after the element with #prev as its id. Notice the span isn't selected since it is not a div and the \"niece\" isn't selected since it is a child of a sibling, not an actual sibling.","code":"\n$( \"#prev ~ div\" ).css( \"border\", \"3px groove blue\" );\n","css":"\n div, span {\n display: block;\n width: 80px;\n height: 80px;\n margin: 5px;\n background: #bfa;\n float: left;\n font-size: 14px;\n }\n div#small {\n width: 60px;\n height: 25px;\n font-size: 12px;\n background: #fab;\n }\n","html":"\n<div>div (doesn't match since before #prev)</div>\n<span id=\"prev\">span#prev</span>\n<div>div sibling</div>\n<div>div sibling <div id=\"small\">div niece</div></div>\n<span>span sibling (not div)</span>\n<div>div sibling</div>\n"},"longdesc":"\n <p>The notable difference between (<code>prev + next</code>) and (<code>prev ~ siblings</code>) is their respective reach. While the former reaches only to the immediately following sibling element, the latter extends that reach to all following sibling elements.</p>\n "}],"slug":"next-siblings-selector"} |