title: JQuery event delegation: how to get the index of a JQuery Object in a Array?
body: <p>I have created an array full of jQuery Object - dom elements:</p>
  
  <pre><code>var tabComponet = new Class({
      var $tab = $("&lt;div class='tab'&gt;&lt;/div&gt;");
      var $container = $("&lt;div id='container'&gt;&lt;/div&gt;");
  
      var tabsArr = [];
      [a, b, c].each(function(){
        tabsArr.push($tab);
        $container.append($tab);
      });
  
      $container.on('click', '.tab', function (e) {
        e.preventDefault();
        var index = $(tabsArr).indexOf($(this));
    }
  });
  </code></pre>
  
  <p>I created tabsArr to avoid when there are multiple components created by this Class above by then there will be multiple components contains .tab class thus using $('.tab') would not be working right, but it seems I could not simply put a $ sign on tabsArr to make this working. Also in the delegation, I should avoid using '.tab' as parameter too, right?</p>
  
  <p>I googled about it, it may be because that everytime I use $ to make a JQuery object they would be not the same but just contain the same value, so $(this) is not in tabsArr, because tabsArr doesn't contain it but just the same value.</p>
  
  <p>so how should I do this? how should I create a object that contains the exact tab elements that belong to its own component?</p>