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

122
Views
jQuery to tsx conversion

Hey there i am trying to convert this jquery to tsx and i am having some issues

$(".nav__trigger").on("click", function (e) {
  e.preventDefault();
  $(this).parent().toggleClass("nav--active");
});

my initial approach

const button = document.querySelector(".nav__trigger");
console.log(button);
button?.addEventListener("click", function (this: any, e: any) {
  console.log("clicked");
  e.preventDefault();
  document.querySelector(this).parent().classList.toggle(".nav--active");
});
Uncaught DOMException: Failed to execute 'querySelector' on 'Document': 'http://localhost:3000/#' is not a valid selector.
    at HTMLAnchorElement

Also i am not sure if the approach i am taking is right or not

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!