您现在的位置是:首页 > 电脑技术查询 > web开发

jquery中的有关问题

编辑:chaxungu时间:2022-10-02 23:16:46分类:web开发

jquery中的问题
jquery中的>是表示什么?
比如
$('#div1>div2')

------解决方案--------------------
http://download.csdn.net/detail/p2227/3936926jQuery官网 | 629博客
--------------------------------------------

parent > child
在给定的父元素下匹配所有的子元素

--------------------------------------------

Matches all child elements specified by child of elements specified by parent.
返回值
Array<Element>

参数
parent (Selector) : 任何有效选择器

child (Selector) : 用以匹配元素的选择器,并且它是第一个选择器的子元素

示例
匹配表单中所有的子级input元素。

HTML 代码:

<form>
<label>Name:</label>
<input name="name" />
<fieldset>
<label>Newsletter:</label>
<input name="newsletter" />
</fieldset>
</form>
<input name="none" />
jQuery 代码:

$("form > input")
结果:

[ <input name="name" /> ]

上一篇:Js俄罗斯方块

下一篇:初学者求教