Wednesday, 2 October 2013

how to get all the child elements in html using jQuery eq() extention?

how to get all the child elements in html using jQuery eq() extention?

I am not very good with jQuery and I have been working on a project and
stuck in a problem regarding jQuery. I have a slider and its html
structure is look like this:
<a class="slides" href="http://pvhorses.net/jersey/about-us/"><img
src="http://pvhorses.net/jersey/wp-content/uploads/2013/08/front-pic-slide.jpg"
alt="" class="change"></a>
and this is the jQuery:
jQuery(function(){
//init js styles
jQuery('body').addClass('hasJS');
// homepage cycles
jQuery('#feature_gallery .bigimg').wrapAll('<div
class="bigimgs">').parents('#feature_gallery').append('<ul class="menu"
id="feature_gallery_pager">').cycle({
fx:'fade',
easing: 'swing',
inDelay: 250,
drop: 40,
timeout: 5000,
pause: true,
slideExpr: '.bigimg',
before:onBefore,
pager: '#feature_gallery_pager',
pagerAnchorBuilder: function(idx, slide) {
var img = jQuery(".slides").children().eq(0).attr("src");
return '<li><a href="#"><img src="'+img+'"
class="thumb"><span></span></a></li>';
}
});
Now I am trying to get the "src" attribute from the anchor link (a) with a
class of slides and I am getting it pretty much but the problem is I am
getting only the first element. I want to get the attr "src" from all the
children elements of it.
HOW CAN I ACHIEVE THAT?
Please help me and reply me as soon as you can.
Thank you,
Usman Ali Qureshi

No comments:

Post a Comment