tags:

views:

39

answers:

1

Is there a way to get i without looping? like e.ThisIndex?

$('#userContentImages li a').live('click', function (e) {
    if (e.button != 0)
        return false;
    var objs = $('#userContentImages li a');    
    for(var i=0; i<objs.length; i++)
    {
        if($(this).get(0) == objs.get(i))
            break;
    }
    //do stuff
    return false;
});
+2  A: 
var i = $('#userContentImages li a').index(this);
Anurag
i get -1. (6 more to go..)
acidzombie24
can you paste the html?
Anurag
well, working code is above... -edit- i cant really paste any.
acidzombie24