Jquery/JS prevent right click menu in browsers

前端 未结 12 1746
孤城傲影
孤城傲影 2020-12-03 00:42

I have my div with a right click popup menu:

// Attatch right click event to folder for extra options
$(\'#fBox\' + folderID).mousedown(function(event) {
            


        
12条回答
  •  死守一世寂寞
    2020-12-03 00:54

    You can disable context menu on any element you want:

    $('selector').contextmenu(function() {
        return false;
    });
    

    To disable context menu on the page completely (thanks to Ismail), use the following:

    $(document).contextmenu(function() {
        return false;
    });
    

提交回复
热议问题