如何查找div的第一个直接子元素 [英] How to find the first direct child element of a div

查看:124
本文介绍了如何查找div的第一个直接子元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这应该很容易,但是我做不到.

This should be easy but I am not able to do it.

我有一个id为"LeftScrollableDiv"的div元素,我正在尝试查找其下的第一个子元素:

I have a div element with id "LeftScrollableDiv" and I am trying to find the first child element under it:

$("#LeftScrollableDiv:first-child");

<div id="LeftScrollableDiv:first">
   <table></table>
</div>

但是结果为空.有帮助吗?

But the result is null. Any help??

推荐答案

$('#LeftScrollableDiv').children().first();

API

这篇关于如何查找div的第一个直接子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆