1 line
1.0 KiB
JSON
1 line
1.0 KiB
JSON
{"name":"only-child","type":"selector","title":":only-child Selector","deprecated":null,"removed":null,"desc":"Selects all elements that are the only child of their parent.","categories":["selectors/child-filter-selectors","version/1.1.4"],"entries":[{"return":"","signatures":{"added":"1.1.4"},"examples":{"desc":"Change the text and add a border for each button that is the only child of its parent.","code":"\n$( \"div button:only-child\" ).text( \"Alone\" ).css( \"border\", \"2px blue solid\" );\n","css":"\n div {\n width: 100px;\n height: 80px;\n margin: 5px;\n float: left;\n background: #b9e;\n }\n","html":"\n<div>\n <button>Sibling!</button>\n <button>Sibling!</button>\n</div>\n\n<div>\n <button>Sibling!</button>\n</div>\n\n<div>\n None\n</div>\n\n<div>\n <button>Sibling!</button>\n <button>Sibling!</button>\n <button>Sibling!</button>\n</div>\n\n<div>\n <button>Sibling!</button>\n</div>\n"},"longdesc":"\n <p>If the parent has other child elements, nothing is matched.</p>\n "}],"slug":"only-child-selector"} |