Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

406
Visualizações
pointerdown vs onclick: what is the difference?

What is the difference between the onpointerdown and onclick event handlers?

Are there any practical differences? Are the events not propagated the same up the DOM tree? Are there some devices that only respond to one of these events?

I initially assumed that it is only pointerdown that is triggered in touch devices or with a pen, but onclick seems to be triggered as well.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

  1. Are there any practical differences?

Yes there are.

pointerDown it's actually equivalent to onMouseDown but the main difference is that mouseDown only sends to an Element but pointerDown can be sent to Document, Window, and Element.

  1. What is the difference between the onpointerdown and onclick event handlers?
  • pointerDown can captures the right/left/middle clicks.

  • onClick only captures the left click.

Live Example:

The example will make it clearer.

https://codepen.io/nawafscript/pen/WNEyRyO

about 4 years ago · Juan Pablo Isaza Relatório

0

To add to Nawaf answer: The point in time when the evenhandlers are fired is also different (at least when using mouse).

  • onPointerDown fires when the mouse button is pressed down
  • onClick waits for press AND release of the mouse button.
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda