Here’s the scenario:
I am creating a dblclick delegate on a bunch of table cells that contain a class called ‘canEdit’. In a specific instance, I want to remove this delegate, and add a column-based delegate that overwrites the existing one.
Here’s what I have:
$('#' + tableID).delegate('tbody tr td.canEdit', 'dblclick', function () {
// Code Here
});
When a specific property is set, this is what is run:
$('#' + tableID).undelegate('tbody tr td.canEdit', 'dblclick');
$('#' + tableID).delegate('tbody tr td:nth-child(' + index + ').canEdit.select', 'dblclick', function () {
// Code Here
});
I am assuming one of the issues is that I’m removing the delegate on everything. Is there a way I can just overwrite and/or remove the first delegate only on the column? Any ideas of a workaround without having to create an entirely new class?
You could use a conditional to run different code within the handler