Home > database >  Adding a click on button when user click a label only work if i click twice
Adding a click on button when user click a label only work if i click twice

Time:11-20

Hello i'm trying to add an event of click on a button when the user click a label,
its working fine but the user have to click on the label twice i need to make it work from the first click
this is my function :


(function($){



$('.next-on-click .forminator-checkbox-label').on('click', function() {
    $('button.forminator-button.forminator-button-next').trigger('click');
});




})(jQuery);

CodePudding user response:

example:

$('.next-on-click .forminator-checkbox-label').on('dblclick', function() {
    $('button.forminator-button.forminator-button-next').trigger('click');
})

CodePudding user response:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<lable class="next"> Next </lable>
<button class="check">Check</button>

<script>
$('.next').click(function() {
alert("Hi");
    $('button.check').trigger('click');
});
</script>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related