It would be easier not to disable them, but merely to prevent them doing what they automatically do. I would do this using $().delegate
:
$(document.body).delegate('a', 'click', function(e) {
if ($(this).is('.disabled')) { // or whatever logic here
e.preventDefault();
}
});
You could use any logic in the conditional clause, e.g. checking for the existence of other elements on the page, checking a configuration variable, etc.
Edit This won't reliably work if there are handlers higher up the tree that stop propagation. If you have got loads of functions doing things to propagation, your easiest solution would be to do the conditional checking at the start of each function:
$('#your_link').click(function(e) {
if (logic) {
e.stopPropagation();
e.preventDefault();
};
// the rest of your function here
});