Thursday, February 3, 2011

select first child with jquery

Programmer Question

I am trying to select first child of ul and then remove it and then append it in the end of that ul but unfortunately i can not selet first child.



Here is code



current = 0;
$(document).ready(function(){

width=951;

var totalSlides=$(".slider ul li").length;
$(".slider ul").removeAttr('width');
$(".slider ul").attr('width',width*totalSlides);

$('#next img').click(function(){
current -= width;
$(".slider ul").animate({"left":current+"px"}, "slow");
$(".slider ul").append($(".slider ul:first-child"));
//$('.slider ul:firstChild').remove();
});
});


Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails