Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

85
Views
FIlter with dataAtributtes

how i can make a filter cards with cards this my button with category,cards had same categories.I need algorythm, when i choose my category i need see only cards with choosed category cards had same category with this buttons

const categoriesData = categories.map(function(categoryName) {
    return `<li class="hashtag">
         <a href="#" data-category="${categoryName}">${categoryName}</a>
        </li>`;
}).join(``);
  
categoriesList.innerHTML = ``;
categoriesList.insertAdjacentHTML(`afterbegin`, categoriesData);

function onCategoriesListClick(evt) {
    evt.preventDefault();
  
    const button = evt.target.closest(`a`);
    let activeButton = false;

    if (!button) {
      return;
    }
**if(button.hasAttribute('data-category') == cardsData.hasAttribute('data-category')){
    activeButton = false;
    if(button.hasAttribute('data-category') != cardsData.hasAttribute('data-category')){
        activeButt
    }
}** - there i need algorythm to filter cards


};
  
categoriesList.addEventListener('click', onCategoriesListClick);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!