问题
How we can select first div of page using jquery ?
回答1:
jQuery first select: http://api.jquery.com/first-selector/
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.
Sample:
var div = $('div:first');
Fiddler example: http://jsfiddle.net/wBQfm/
回答2:
Get the first using this:
var first_div = $( $('div')[0] );
来源:https://stackoverflow.com/questions/13316869/selecting-first-div-usin-jquery