In my JavaScript-loaded figure, there is an image description and two buttons. Sometimes the description contains a link with a fig attribute, like this:
<a fig="allow" href="#tt5">[1]</a>
If the anchor is not in a figure and has a fig attribute of allow, a new figure with a class of pop-up will be created below the link, making the anchor look like this:
<a class="pop-up" fig="allow" href="tt5">[o]</a>
However, since my anchor is already inside a figure, I simply need to close the figure. But for some reason, .click and .live are not working.
Here are the methods I tried:
Using
.live()
:$viewer.find('div > div > span.Figcontent > a').live('click',function() { toggleViewerCaption(); });
Using .click
$viewer.find('div > div > span.Figcontent > a').click(function(){ toggleViewerCaption(); });
Note:
I have confirmed that the above code is targeting the correct anchor by testing it in the console and getting
tt5
as a result.The debugger doesn't hit the breakpoints even though the console is showing the correct value.