if you use .on()
to bind your event then you could unbind it with .off()
, like so:
Updated to reflect OPs actual needs (I think)
$('.div-class(A) a').on('click', function(){
var url = $(this).attr('href');
var height = $('#div-id(B)').height();
var width = $('#div-id(B)').width();
$('#div-id(B)').replaceWith( "'<object data="+url+" width="+width+" height="+height+"/>'" );
return false;
});
// This will unbind the click action for a tags inside a div with id #sub-b
$('#sub-b a').off('click');
One thing to note, if you use event delegation, then you can't use off on an inner div in this way.