Right-click user menu does not work properly

The right menu on the right works with its functions. But the problem sometimes does not work properly. In my opinion, if you right-click on a table row, the checkbox is set correctly, but after I uncheck the box and try to check again by right-clicking, it does not work.

$('.check').bind("contextmenu", function (event) { event.preventDefault(); $(".custom-menu").finish().toggle(100).css({ top: event.pageY + "px", left: event.pageX + "px" }); }); $(document).bind("mousedown", function (e) { if (!$(e.target).parents(".custom-menu").length > 0) { $(".custom-menu").hide(100); } }); $('tr.check').contextmenu(function (e) { $cb = $(this).find('input[type="checkbox"].selected_check'); $($cb).attr('checked', 'checked'); populate_context_menu($cb); return false; }); 
+6
source share
1 answer

I changed my code to some lines of code and this helps me.

 $(".custom-menu li").click(function () { $(".custom-menu").hide(100); }); function isExist(id) { for (var i = 0; i < values.length; i++) { if (values[i] == id) { return true; } } return false; } $('tr.check').contextmenu(function (e) { $cb = $(this).find('input[type="checkbox"].selected_check'); var id = $($cb).attr('id'); var result = isExist(id); if (!result) { $('.selected_check').attr('checked', false); $('.check').removeClass('highlight_row'); $('.check').addClass('td_bgcolor'); } $($cb).attr('checked', 'checked'); populate_context_menu($cb); return false; }); 
+2
source

All Articles