title: how to get div inside of ul-li-a and make equal inside text of div
body: <p>I have a cached list inside search button and once I choose one of them it should trigger the menu and pick up the right one. However I could not figure out how to compare the <code>innerText</code> of a <code>div</code> with the chosen one from the search area. Both <code>a</code> and <code>div</code> should be visible.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() {
    function filterTable(tbl, term) {
  
      $("ul li a", tbl).show();
      $("ul li a", tbl).each(function(i, r) {
        if ($("div:eq(0)", r).text().toLowerCase().indexOf(term.toLowerCase()) &lt; 0) {
          $(r).hide();
        }
      });
    }
  
    $("#txtsearch").autocomplete({
      source: ["ERP", "Finans Muhasebe", "Banka"],
      select: function(e, ui) {
        filterTable($("table"), ui.item.value);
      },
      minLength: 0
    }).keyup(function() {
      if ($(this).val() == "") {
        $("ul li a").show();
      }
    }).click(function() {
      $(this).autocomplete('search', "");
    })
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.wrap_atletas_interno img {
    line-height: 0;
  }
  
  .wrap_atletas_interno li {
    float: left;
    margin-right: 11px;
    border: 3px solid #d0d2d6;
    line-height: 0;
    position: relative;
    width: 86px;
    height: 86px;
  }
  
  .wrap_atletas_interno li .nome_86_atleta {
    position: absolute;
    width: 75px;
    padding: 8px;
    padding-right: 0px;
    background: #d0d2d6;
    color: #243769;
    font-size: 13px;
    font-style: italic;
    z-index: 1;
    bottom: 6px;
    left: 0px;
  }
  
  .wrap_atletas_interno li.atleta_atual {
    border: 3px solid #c91700;
  }
  
  .wrap_atletas_interno li.atleta_atual .nome_86_atleta {
    background: #c91700;
    color: #ffffff;
  }
  
  .wrap_atletas_interno li.ultimo {
    margin-right: 0;
    margin-bottom: 10px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"&gt;
  &lt;script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;div&gt;
    &lt;input id="txtsearch" type="text" placeholder="Search Here..." /&gt;
  &lt;/div&gt;
  &lt;ul class="menu-content openMenu"&gt;
    &lt;li class="menuItem"&gt;
      &lt;a href="javascript:void(0)"&gt;
        &lt;div class="iconBox color-ER"&gt;E&lt;/div&gt;&lt;span class="title"&gt;ERP&lt;/span&gt;&lt;span class="arrow"&gt;&lt;/span&gt;
      &lt;/a&gt;
      &lt;ul class="sub-menu"&gt;
        &lt;li id="0"&gt;&lt;a href="javascript:void(0)"&gt;&lt;i class="fa fa-cube fa-lg"&gt;&lt;/i&gt;&lt;span class="title"&gt;Finans Muhasebe&lt;/span&gt;&lt;span class="arrow"&gt;&lt;/span&gt;&lt;/a&gt;
          &lt;ul class="sub-menu"&gt;
            &lt;li&gt;&lt;a href="javascript:void(0)"&gt;Cari&lt;span class="arrow"&gt;&lt;/span&gt;&lt;/a&gt;
              &lt;ul class="sub-menu"&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=ch.list_caris"&gt;
                    &lt;div class="objectText"&gt;Cari İşlemler&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=ch.list_company_extre"&gt;
                    &lt;div class="objectText"&gt;Cari Extre&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=ch.payment_track&amp;amp;money_info"&gt;
                    &lt;div class="objectText"&gt;Borç Alacak Dökümü&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=ch.form_add_debit_claim_note"&gt;
                    &lt;div class="objectText"&gt;Dekont Ekle&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=ch.form_add_cari_to_cari"&gt;
                    &lt;div class="objectText"&gt;Cari Virman Ekle&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=ch.form_add_cari_rate_valuation"&gt;
                    &lt;div class="objectText"&gt;Kur Değerleme İşlemleri | CARİ&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=ch.form_upd_account_open"&gt;
                    &lt;div class="objectText"&gt;Dönem Açılışı&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
              &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="javascript:void(0)"&gt;Banka&lt;span class="arrow"&gt;&lt;/span&gt;&lt;/a&gt;
              &lt;ul class="sub-menu"&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_bank_account"&gt;
                    &lt;div class="objectText"&gt;Banka Hesapları&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_bank_actions"&gt;
                    &lt;div class="objectText"&gt;Banka İşlemleri&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_virman"&gt;
                    &lt;div class="objectText"&gt;Döviz Alış Satış Virman İşlemi&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_assign_order"&gt;
                    &lt;div class="objectText"&gt;Banka Talimatları&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_invest_money"&gt;
                    &lt;div class="objectText"&gt;Para Yatırma&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_gelenh"&gt;
                    &lt;div class="objectText"&gt;Gelen Havale&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_creditcard_revenue"&gt;
                    &lt;div class="objectText"&gt;Kredi Kartı Tahsilatları&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_credit_card_expense"&gt;
                    &lt;div class="objectText"&gt;Kredi Kartıyla Ödemeler&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_get_money"&gt;
                    &lt;div class="objectText"&gt;Para Çekme&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_gidenh"&gt;
                    &lt;div class="objectText"&gt;Giden Havale&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_payment_credit_cards"&gt;
                    &lt;div class="objectText"&gt;Kredi Kartı Hesaba Geçiş&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=finance.list_creditcard"&gt;
                    &lt;div class="objectText"&gt;Kredi Kartları&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_bank_rate_valuation"&gt;
                    &lt;div class="objectText"&gt;Kur Değerleme İşlemleri | BANK&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_bank_autopayment_export"&gt;
                    &lt;div class="objectText"&gt;Otomatik Ödeme İşlemleri&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_term_deposit"&gt;
                    &lt;div class="objectText"&gt;Vadeli Mevduat Hesaba Yatır&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_bank_autopayment_import"&gt;
                    &lt;div class="objectText"&gt;Otomatik Ödeme İşlemleri Dönüşleri&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.interest_revenue"&gt;
                    &lt;div class="objectText"&gt;Vadeli Mevduat Getiri Listesi&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=finance.list_bank_branch"&gt;
                    &lt;div class="objectText"&gt;Banka Şubeleri&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.form_add_bank_account_open"&gt;
                    &lt;div class="objectText"&gt;Hesap Açılışı&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=finance.list_bank_types"&gt;
                    &lt;div class="objectText"&gt;Bankalar&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=finance.list_bank_pos"&gt;
                    &lt;div class="objectText"&gt;Pos Tanımları&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.list_pos_operation"&gt;
                    &lt;div class="objectText"&gt;Otomatik Sanal Pos Kuralları&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=finance.list_credit_payment_types"&gt;
                    &lt;div class="objectText"&gt;Kredi Kartı Ödeme/Tahsil Yöntemleri&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=settings.list_pos_relation"&gt;
                    &lt;div class="objectText"&gt;Sanal Pos Tanımları&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;
                  &lt;a href="/index.cfm?fuseaction=bank.wodiba_bank_actions"&gt;
                    &lt;div class="objectText"&gt;WoDiBa Banka İşlemleri&lt;/div&gt;&lt;span class="objectAdd"&gt;&lt;/span&gt;
                  &lt;/a&gt;
                &lt;/li&gt;
              &lt;/ul&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is the <a href="http://jsfiddle.net/cagatay07/x7amLdhs/8/" rel="nofollow noreferrer">jsfiddle</a></p>
  
  <p><strong>UPDATED:</strong></p>
  
  <p>Not all sub-menu elements should be visible, except for the <code>class="objectAdd"</code>.
  if the user has typed 'Cari', all relevant 'Cari' which has objectAdd class must be visible. An example picture has been added.</p>
  
  <p><a href="https://i.stack.imgur.com/oVZKc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oVZKc.png" alt="enter image description here"></a></p>