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

198
Vistas
e.preventDefault() is not working with mousedown event?

I have written below code to prevent click event. Its working as expected with below code.

$(".k-grid-filter").on('mousedown', function (e) {
    var editRow = $(this).closest(".k-grid").find(".k-grid-edit-row");
    if (editRow.length > 0) {
        e.preventDefault();
        e.stopImmediatePropagation();
        alert(e.type);
    }
});

But I don't want to display alert pop-up. If I remove alert(), preventDefault() is not working.

$(".k-grid-filter").on('mousedown', function (e) {
        var editRow = $(this).closest(".k-grid").find(".k-grid-edit-row");
        if (editRow.length > 0) {
            e.preventDefault();
            e.stopImmediatePropagation();
        }
    });

Can anybody please help me to find is missing and what has to be done to make is work? Thanks in advance :)

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

0

Neither of mouseup or mousedown prevent the default click event.

See this answer for more details.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can't use e.preventDefault() in mousedown and mouseup event because the function only works on click you have to select that part.

The mousedown event is fired at an Element when a pointing device button is pressed while the pointer is inside the element.

you can check reference of this link here

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