[jQuery] some $.index() prob
Hello guys,
recently I faced problem with index function, example in documentation
works perfectly but it's slightly simple. When I try to use this
function in more complexed way it's not working, here's what I'm
trying to:
$("#organize > ul").mousedown(
function(e){
if($(e.target).is("img")){
var $li = $(e.target).parent();
var $index = $("#id > ul.tabs > li").index($li);
$("#id > ul").tabs("close", $index);
}
});
this piece of code is for the tab close image situated in <li>
element.
console.log always show that $index is -1. I've tried a lot of
different ways to get index of li, but all of them failed. Now the
question - maybe my understanding of this function isn't right and it
can be done in different way? All what I need is index of li element
that's hold img in it to pass it to "close" method of tabs.
Thanks.