Check jquery index

Is there a way to get me without a loop? how is 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


source to share


1 answer


var i = $('#userContentImages li a').index(this);

      



+3


source







All Articles