开发者

disable clicking of a divs element

I have div that goes in to an edit mode... the div contains buttons, links++. In edit mode i want to disable all开发者_开发技巧 of these, and enable them when i exit edit mode.

Ive tried

$("#container").children().disableSelection();

but it does not work :-(


Edit mode enter:

$("#container").children().bind('click', function(){ return false; });

Edit mode exit:

$("#container").children().unbind('click');


Give all elements that you want to prevent clicking a class of "noclick", then when in edit mode:

$(".noclick").click(function(e) {
    if(editMode) {
        e.preventDefault();
    }
});


you use below that will help you:

$("#container").hide();

and when exit edit mode do: $("#container").show();


css:

.dis{pointer-events:none}

Jquery:

$("#container").addClass("dis"); //disables

$("#container").removeClass("dis"); //enables

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜