HideSeek icon indicating copy to clipboard operation
HideSeek copied to clipboard

Keywords to search on each element

Open guilhermemarconi opened this issue 8 years ago • 1 comments

Is that possible to set a data-attribute on each item to be searched and, if it has the attribute data-keywords (or whatever), the plugin filter only that words instead of the element content?

I'm making a dashboard on my job where I list every clients and all of them has links to their applications, but all the links has the same names, with different hrefs. Example:

<div class="client">
  <h3 class="client__name">${name}</h3>
  <ul class="client__links">
    <li class="client__link">
      <a href="//${id}.vtexcommercestable.com.br">
        Stable
      </a>
    </li>
    <li class="client__link">
      <a href="//${id}.vtexcommercestable.com.br/admin">
        Admin
      </a>
    </li>
    <li class="client__link">
      <a href="//${id}.vtexcrm.com.br">
        CRM
      </a>
    </li>
    <li class="client__link">
      <a href="//${id}.ds.vtexcrm.com.br">
        Master Data
      </a>
    </li>
  </ul>
</div>

Sometimes I would like to type zeedog, but the client name is Zee.Dog, hiding it just because I can't set some keywords specifics to that list item.

guilhermemarconi avatar Mar 18 '17 00:03 guilhermemarconi

Hi, if I understand correctly, you want to search against a custom attribute such as data-keywords... That can be done by setting the name of the attribute to the option attribute:

$('#search').hideseek({
    attribute: 'data-name'
});

Here is an example based on your html code: https://jsfiddle.net/dkrestos/8Ldkb1qd/

vdw avatar Apr 24 '17 21:04 vdw