编程学问
  • 文章
  • 问题
  • 读书
  • 关于
  • 登录
jQuery API 开发手册

返回值:Array<Element(s)>:only-child

V1.1.4概述

如果某个元素是父元素中唯一的子元素,那将会被匹配

如果父元素中含有其他元素,那将不会被匹配。

示例

描述:

在 ul 中查找是唯一子元素的 li

HTML 代码:
<ul>
  <li>John</li>
  <li>Karl</li>
  <li>Brandon</li>
</ul>
<ul>
  <li>Glen</li>
</ul>
jQuery 代码:
$("ul li:only-child")
结果:
[ <li>Glen</li> ]
相关文章
css e last childcss e only childjquery easyui easyui更新说明parent child jquery first child jquery last child jquery nth child jquery only child jqueryjquery parent > childjquery first childjquery last childjquery nth childjquery nth last childjquery only childjquery only of typejquery undelegate s t fn php domnode adds new child at the end of the childrenphp com 函数 divides two variants and returns only the remainderphp swoole process stop the child processes.php zookeeper return the timeout for this session only valid if the connections is currently connected ie. last watcher state is zoo connected state . this value may change after a server re connect
关注编程学问公众号
编程学问网 湘ICP备20001732号