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

203
Views
How can I remove On click attribute using "nav-item dropdown" class

How can I remove On click attribute using "nav-item dropdown" class

<li class="nav-item dropdown">                    
<a class="nav-link " "="" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" onclick="window.location.href='/camping-tents'">Camping Tents</a></li>

<li class="nav-item dropdown">                    
<a class="nav-link " "="" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" onclick="window.location.href='/camping-tents2'">Camping 3</a></li>

<li class="nav-item dropdown">                    
<a class="nav-link " "="" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" onclick="window.location.href='/camping-tents3'">Camping 3</a></li>

<li class="nav-item"><a class="nav-link " bell-tents" style="background:0;"> Bell Tents</a></li>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can use querySelectorAll to get all links under elements that have "nav-item dropdown" class and then itirate over these a elements to remove their onclick attributes:

Array.from(document.querySelectorAll('.nav-item.dropdown a')).forEach((el) => {
  el.removeAttribute('onclick')
})
about 4 years ago · Juan Pablo Isaza Report

0

First, fix your markup issues. Then, use .removeAttribute('onclick') method on the elements in question.

about 4 years ago · Juan Pablo Isaza Report
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!