I want to imitate an anchor click when a user clicks on the containing <TD> but having problems.
This is the JS part:
$('contactTab').click(function() {
$('contactTabLink').trigger("click");
});
And this is the HTML part:
<td class="previewTabs" id="contactTab">
<a class="previewTabLink" id="contactTabLink" rel="#contactOverlay">CONTACT</a>
</td>
When somebody clicks the <TD> contactTab, it should trigger a click event on <A> contactTabLink which then launches an Overlay. My problem is that the JS function with click listener is NOT firing at all.
Can anybody see where I am going wrong?
EDIT 1:
I have changed the selectors to have #'s but it still won't fire the function.
$('contactTab')will try to find an element with tagcontactTab. You want the ID-selector. Triggering the click event won't make the browser follow the link though.$('contactTabLink')? You have the click being triggered, but I don't see any listener defined for it, so there's no action to take on a click event.