Context menu right click -- Jquery -


iam using jquery context menu in these way..,

function applycontextmenu() { $.contextmenu({     selector: '.pnlaccordion h3',     callback: function (key, options) {         contextmenuaction(key, options, $(this));     },     items: {         "add": { name: "add port", icon: "add" },         "edit": { name: "edit port", icon: "edit" },     }  }); }   function contextmenuaction(key, options, $port) {             $(".dialogadd").dialog('open');      if (key == "add") {        $(".dialogadd").dialog({         height: 238,         width: 465,         resizable: false,         title: "add ports"      });         $(".imgbtnupdatecontext").click(function () {             //ajax call action             success: function (jsondata) {                     try {                          $(".dialogadd").dialog('close');                         }      }          }); 

here after many trials on hide() , show() of dialog, found problem not hide() , show() of dialog, on context menu right click.

problem:

when hit right click "add" first time inserting 1 record when hit second time inserting 2 times same record, third time 3 times same record.

here second time if not hit update button entering it,

problem on right click, counting number of clicks on right click , entering update button, how should restrict entering update click second time / third time

use event.preventdefault(), on called, default action of event not triggered.

also bind click event using .on('click', function()) handler

$(".imgbtnupdatecontext").on('click', function (e) {         //ajax call action     success: function (jsondata) {         try {             $(".dialogadd").dialog('close');         }     }             e.preventdefault(); }); 

updates:

$(".imgbtnupdatecontext").unbind("click").click(function () {     //ajax call action     success: function (jsondata) {         try {             $(".dialogadd").dialog('close');         }     } }); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -