views:

29

answers:

1

I've got:

j=0;
an = $("#thumbSlider" + j + " a").eq(1);
ap = $("#thumbSlider" + j + " a").eq(0);

jQuery("div#thumbSlider" + j + " a").each(function(z) { 
  jQuery(this).bind("click", function(){
    ad = jQuery("#thumbSlider" + j + " a").eq(1);
    alert(ad.length);

. .

The first alert returns 1, but the second, on click, returns 0. Why is that?

A: 

Would

jQuery(this).bind("click", function(){
  alert(this.length);

Not be what you're looking for?

bradenkeith
Not really, I want to get the next and prev elements, "1" was just an example.alert(jQuery(this).next().length); returns 0.I've got 8 links and 2 prev/next buttons, when I click on a link I want to set the prev/next values so that when I click on the buttons it will point to that link.But still, I can not get why it returns 2 different values, 1 in the main script, but 0 in the click function.
newsblitz