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

132
Views
I have a drupal 9 view that is showing a grid of items. I am trying to remove CSS classes from these items using JS

I am working on a view where it lists my articles. I need to remove CSS classes from each of these articles in this page. My code is working on the first item but it is not looping on the other items existing on the page.

Here is my code:

Drupal.behaviors.cardload = {
  attach: function (context, settings) {
  const $el = context.querySelector(".user-card");
  const $content = context.querySelector(".card__content");

// Loading finished

  setTimeout(() => {
  $el.classList.remove('skeleton');
  $el
  .querySelectorAll(".skeleton")
  .forEach(el => el.classList.remove("skeleton"));
  $el
      .querySelectorAll(".hide-text")
      .forEach(el => el.classList.remove("hide-text"));
  $content.classList.remove('skeleton');
  $content
      .querySelectorAll(".hide-text-title")
      .forEach(content => content.classList.remove("hide-text-title"));
      $content
      .querySelectorAll(".hide-text")
      .forEach(content => content.classList.remove("hide-text"));
      $content
      .querySelectorAll(".hide-text-body")
      .forEach(content => content.classList.remove("hide-text-body"));
      $content
      .querySelectorAll(".hide-text-author")
      .forEach(content => content.classList.remove("hide-text-author"));
}, 1000);
}
}

Can someone please help me how to add a for loop or something that fetches all the items in my view and remove all the classes from all the items after 1000 milliseconds?

Thank you

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!