jakiestfu / Context.js

Contextual Menus with Twitters Bootstrap.css
http://lab.jakiestfu.com/contextjs/
248 stars 62 forks source link

Is it possible to enable or disable item #13

Open handoyo opened 10 years ago

handoyo commented 10 years ago

Hi,i would like to ask if it's possible to enable or disable menu item via code programtically?Thanks a lot.

AchoArnold commented 10 years ago
// jQuery 1.7+
$(function () {
    $('a.something').on("click", function (e) {
        e.preventDefault();
    });
});

// jQuery < 1.7
$(function () {
    $('a.something').click(function (e) {
        e.preventDefault();
    });

    // or 

    $('a.something').bind("click", function (e) {
        e.preventDefault();
    });
});

stack overflow solution

handoyo commented 10 years ago

Hi,thanks for the help.But what i would like to achieve is to disable menu item from clicking instead of preventing it to open href.

AchoArnold commented 10 years ago

I don't understand what you mean by preventing it from clicking. @handoyo see this http://stackoverflow.com/questions/10276133/how-to-disable-html-links