check the index jquery

Posted by acidzombie24 on Stack Overflow See other posts from Stack Overflow or by acidzombie24
Published on 2010-04-11T01:39:58Z Indexed on 2010/04/11 1:43 UTC
Read the original article Hit count: 310

Filed under:

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;
});

© Stack Overflow or respective owner

Related posts about jQuery