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

219
Visualizações
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 Respostas
Responde à pergunta

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 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