Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
How to disable redirecting for some elements in an anchor tag?

I have the following code :-

<a href="/">
 <h1>Hello Wolrd</h1>
 <p>This is some description</p>
 <div>....this is Image Carousel</div>
 <div class="dotButton>
   <button></button>
   <button></button>
   <button></button>
 </div>
</a>

Here I put a image carousel with dot button in a link tag. Here I face one problem. When I click the card it redirects href link for using a tag. But problem is when I click dot button to slide the images, it ridirect href link. How can I disable href and working dot button for sliding images.

Thank you!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can use this :

<a href="javascript:void(0)">
 <h1>Hello Wolrd</h1>
 <p>This is some description</p>
 <div>....this is Image Carousel</div>
 <div class="dotButton">
   <button></button>
   <button></button>
   <button></button>
 </div>
</a>

And after that when you will click the image it will not redirect you anymore.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use onClick handler function if you want to run some logic like this:

// for functional Components

const handleClick=(e)=>{
     e.preventDefault();
    // write your logic for on click
}

 <a onClick={handleClick}>
   <h1>Hello Wolrd</h1>
   <p>This is some description</p>
   <div>....this is Image Carousel</div>
   <div class="dotButton">
     <button></button>
     <button></button>
     <button></button>
   </div>
</a>

with this you can do your other stuff on clicking the anchor without redirecting.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda