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

290
Views
¿Cómo deshabilitar un botón al hacer clic en otra página?

Tengo una página web (usando thymeleaf, html, css, javascript) y hay una barra de búsqueda con un botón. Quiero otro botón deshabilitado cada vez que se hace clic en el primero. Traté de hacerlo con un código javascript como este :

 const button1 = document.querySelector('#button1'); const button2 = document.querySelector('#button2'); const disableButton = () => { button1.disabled = true; }; button2.addEventListener('click', disableButton);

Pero el problema es que cuando hago clic en el botón de búsqueda, en realidad me redirige a otra página y ese código solo funciona en una página. También traté de usar thymeleaf si una expresión como esta:

 <div th:if="${#httpServletRequest.requestURI == '/example/WEB-INF/views/inbox.jsp'}"> some content </div>

Pero arroja una excepción ya que httpServletRequest es nulo/o no se reconoce. Entonces, tengo dos botones con identificadores y quiero deshabilitar uno de ellos cuando se hace clic en el otro y me redirige a otra página. ¿Cómo logro eso?

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!