Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!