How to count click about dblclick and do something after 4 clicks in jQuery?
Asked Answered
D

0

0

To letdoSetTag function take effect, before that and the first clicking(doule click, 2 clicks), some html elements will be highlight displayed, when user click button again(the second double-click, 4 clicks), then doSetTag(tagid); takes effect. Below colde takes effect at once double-click(2 clicks), so I would like to count the dbclick and let doSetTag(tagId) works after the second double-click(4 clicks).

$('#tagLabels .minitag-label').attr('title','Double-Click to cancel the tag').unbind().on('dblclick',function(){
    var labelid = $(this).data('id');
    var labelName = $(this).text();
        if (res.has(tagName) == 1){
            window.location.hash = "#resTags";
            setTimeout(function()
                {
                $(hash).css('background-color', '#D8CEC9').animate({
                    backgroundColor: '#00A087'
                }, 200);
                    doSetTag(tagid);
                },5000);
        }
})
Depressive answered 15/8, 2020 at 2:31 Comment(6)
Really not clear what you are asking or needing to accomplishDevotional
can you add the html so we can try to recreate the scenarioPrandial
@Devotional Hi, I updated my question, How to count click about dblclick and do something after 4 clicks in jQuery?Depressive
@KarlL Hi, I updated my question, How to count click about dblclick and do something after 4 clicks in jQuery?Depressive
Put a counter that will count no. of click and if count = 4 execute your function and reset your count to 0 againTav
Yes, I need a counter, but I don't know how and whereDepressive

© 2022 - 2024 — McMap. All rights reserved.