Reputation: 13620
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 :-(
Upvotes: 9
Views: 37513
Reputation: 2388
css:
.dis{pointer-events:none}
Jquery:
$("#container").addClass("dis"); //disables
$("#container").removeClass("dis"); //enables
Upvotes: 0
Reputation: 21919
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();
}
});
Upvotes: 2
Reputation: 2852
you use below that will help you:
$("#container").hide();
and when exit edit mode do: $("#container").show();
Upvotes: 0
Reputation: 1183
Edit mode enter:
$("#container").children().bind('click', function(){ return false; });
Edit mode exit:
$("#container").children().unbind('click');
Upvotes: 21