Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keywords to search on each element #49

Open
guilhermemarconi opened this issue Mar 18, 2017 · 1 comment
Open

Keywords to search on each element #49

guilhermemarconi opened this issue Mar 18, 2017 · 1 comment
Labels

Comments

@guilhermemarconi
Copy link

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.

@vdw vdw added the question label Apr 24, 2017
@vdw
Copy link
Owner

vdw commented Apr 24, 2017

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants