How to get child elements of $self, jquery is OK
$('#cont > fieldset').each(
function(index){
        var $self = $(this);
        // Here how to get child elements? How to write this selector?
        //$('$self > div') ?? this seems does not work.
});
$self.find("div"); // return all descendant divs
or:
$self.children("div"); // return immediate child divs
depending on whether you want immediate children or any descendants.
 You can even do this to get immediate child divs, but children is prettier :  
$self.find(">div");
 Look at the .children method in jQuery.  This will get direct children of the element, eg:  
$self.children('div') // returns divs that are direct children
 You can also use the similar .find method if you need to go deeper than one level.  
$self.find('div') // returns divs that are direct children, or children of children
 Also, you can select using $self as the context, like:  
$('div', $self) //returns all divs within $self
using children
 $(this).children('div')
or using find
$(this).find('div');
look on this post
链接地址: http://www.djcxy.com/p/26684.html上一篇: jquery淡出幻灯片面板
