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

215
Vistas
How to user .trigger() inside .dblclick() in jquery

I am trying to perform a trigger click of the button on the double click of the list element. I have 2 elements. One is a button and the second is a UL list element.

Here is the HTML button and List code.

<button type="button" class="btn btn-primary" data-toggle="modal" id="show_comment_modal" data-target="#showCommentModal">  Show Comment </button>

<ul>
    <li id="category_list_1">Coffee</li>
    <li id="category_list_2">Tea</li>
    <li id="category_list_3">Milk</li>
</ul>  

Here is the Jquery code:

    $( "#category_list_1" ).dblclick(function() {
        $( "#show_comment_modal" ).trigger( "click" );
    });

I did not get any error in console. Did this even possible?

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

0

$('#show_comment_modal').click(function() {
  alert('button click');
});

$('.category').dblclick(function() {
  $('#show_comment_modal').click();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button type="button" class="btn btn-primary" id="show_comment_modal">  Show Comment </button>

<ul>
    <li class="category" id="category_list_1">Coffee</li>
    <li class="category" id="category_list_2">Tea</li>
    <li class="category" id="category_list_3">Milk</li>
</ul>

Here you have a code snippet with an example

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