在jQuery中选择第一个div [英] Selecting first div usin jquery
本文介绍了在jQuery中选择第一个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何使用jquery选择页面的第一个div?
How we can select first div of page using jquery ?
推荐答案
jQuery首先选择: http://api.jquery.com/first-selector/
jQuery first select: http://api.jquery.com/first-selector/
:first伪类等效于:eq(0).也可能是 编写为:lt(1).虽然这只匹配一个元素, :第一个孩子可以匹配多个:每个父母一个.
The :first pseudo-class is equivalent to :eq(0). It could also be written as :lt(1). While this matches only a single element, :first-child can match more than one: One for each parent.
示例:
var div = $('div:first');
提琴手的例子: http://jsfiddle.net/wBQfm/
这篇关于在jQuery中选择第一个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文