I am calling a jquery.fancybox link from the click event bound to a table row. The action works fine the first time, however, if I close the fancybox and click again on any row the anonymous function bound to the row still fires, but fancybox doesn't start up. Here's the javascript I'm using:
$jq(document).ready(function() {
$jq('a.edit').fancybox({
'overlayShow': true,
'hideOnContentClick': false
});
$jq('tr').click(function() {
alert("clicked");
$jq(this).find('a.edit').trigger("click");
});
});
So, then in the HTML I have anchors classed as "edit":
<tr>
<td>...</td>
<td>
<a href="/candidates/22/qualifications/16/edit" class="edit">edit</a>
</td>
</tr>
I can always see the alert box, and I can change the trigger / click() call to remove() and it will "work", removing the anchors on multiple occasions. I can also repeatedly manually click the $('.edit') link itself and it's all good.
So how is it that the anchor click event fires only once when coming in turn from the row click event? Is it something to do with the call I am making to $(this) when describing the function?
$jq(this).find('a.edit').length
? – naivists