After click on a button my script loads new content. As long as it is loading I don't want a list of elements to be clickable.
IS there any way to unbind the click-event of those elements, load the content and then "rebind" the events correctly?
What I want to prevent is a if-statement inside every click-function/element.
Here is what i've tried:
$(load_button).click(function(){
$('a').each(function(){
var dis_e = $(this).data('events');
$(this).data('disabled-events', dis_e);
}).unbind('click');
$(some_content).load(function(){
$('a').each(function(){
var dis_e = $(this).data('disabled-events');
$(this).removeData('disabled-events');
$(this).bind('click', dis_e);
});
});
});
UPDATE:
it should also prevent the elements from (in this case) alerting 'click':
$('a').click(function(){
alert('click');
});