Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:02:13+00:00 2026-06-13T13:02:13+00:00

I’m trying to update contextmenu item if ajax requests alters my div content. Here

  • 0

I’m trying to update contextmenu item if ajax requests alters my div content.

Here is what I mean I have a div like this :

<div id="" class="message" data-options='{"update":"YES", "delete":"NO">
</div>

And context Menu jquery part (this happens only once when body loads):

$.contextMenu({
        selector: '.message', 
        trigger: 'left',
        callback: function(key, options) {
            var m = "clicked: " + key;
            window.console && console.log(m) || alert(m); 
        },
        items: {
            "update": {
                name: "Update",
                disabled: function(key, opt) { 
                    return (this.data("options").update === "NO")
                },
            },
            "delete": {
                name: "Delete", 
                 disabled: function(key, opt) { 
                    return (this.data("options").delete=== "NO")
                }
           //etc. rest of the code

I’m looking to re-create it when some ajax request happens or disable/enable items somehow

So now some ajax requests happen and on success I’m trying to update div.message data-option because I though of enabling/disabling buttons like this :

In ajax.success function :
- disable or enable menu items 

--------Actually--------Simplified

Actually this question/answer is very similar to my current issue :

Disable and enable jQuery context menu

I want to enable/disable contextMenu item on some button click, if I were able to do in this dummy example I think I could handle ajax request as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:02:14+00:00Added an answer on June 13, 2026 at 1:02 pm

    I used build option to add new items, you can see that you can do with items here whatever you want: http://jsfiddle.net/oceog/Tvv4P/1/

    HTML:

    <div class="context-menu-one box menu-1">
        <strong>right click me</strong>
    </div>
    
    <button id="add"> Add item</button>
    <button id="disable_cut"> Disable cut</button>
    <button id="enable_cut"> enable cut</button>
    ​
    

    JS:

    $.contextMenu({
        selector: '.context-menu-one',
        build: function($trigger, e) {
            console.log(e);
            return {
                callback: function(key, options) {
                    var m = "clicked: " + key;
                    console.log(m);
                    //window.console && console.log(m) || alert(m); 
                },
                items: items
            };
        }
    });
    var items = {
        "edit": {
            name: "Edit",
            icon: "edit"
        },
        "cut": {
            name: "Cut",
            icon: "cut"
        },
        "copy": {
            name: "Copy",
            icon: "copy"
        },
        "paste": {
            name: "Paste",
            icon: "paste"
        },
        "delete": {
            name: "Delete",
            icon: "delete"
        },
        "sep1": "---------",
        "quit": {
            name: "Quit",
            icon: "quit"
        }};
    var newitemN=0;
    $('#add').click(function() {
                var newitem={};
            newitem['newitem_'+newitemN]={
                name: 'new item #'+newitemN,
                icon: "copy"
            };
       newitemN++;
       $.extend(items,newitem);
    });
    
    $('#disable_cut').click(function() {
        items.cut.disabled=true;
    });
    
    $('#enable_cut').click(function() {
        items.cut.disabled=false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Basically, what I'm trying to create is a page of div tags, each has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.