I’m trying to use the delegate function and not succeeding, here is my html…
<td class="ms-vb-icon">
<a tabindex="-1" href="/ACKNOWLEDGEMENT%20OF%20DEBT%20-%20SCOTLAND.doc"
onclick="return DispEx(this,event,'TRUE','FALSE','TRUE','SharePoint.OpenDocuments.3','0','SharePoint.OpenDocuments','','','','41','1','0','0x7fffffffffffffff')">
<img border="0" alt="ACKNOWLEDGEMENT OF DEBT - SCOTLAND.doc" title="ACKNOWLEDGEMENT OF DEBT - SCOTLAND.doc" src="/_layouts/images/icdoc.gif"></a>
</td>
This is generated for me by SharePoint, there’s a lot more in the table which may be a factor to my problem, please see here for the full listing. The html for the table (id onetidDoclibViewTbl0) is generated after the page has loaded; via an ajax call.
My attempt at using the delegate function…
$('#onetidDoclibViewTbl0').delegate('tr td.ms-vb-icon a', 'click', function(event) {
alert(‘document anchor clicked’);
});
I even tried this which didn’t work either
$('body').delegate('a', 'click', function() {
alert('this really should work?');
});
Most of your links have an onclick attribute that has a
return false;. This prevents the event from bubbling up the DOM, which thedelegatemethod relies on to function correctly.