TheCarver TheCarver - 2 years ago 301
jQuery Question

jQuery - Imitate Click

I want to imitate an anchor click when a user clicks on the containing

but having problems.

This is the JS part:

$('contactTab').click(function() {

And this is the HTML part:

<td class="previewTabs" id="contactTab">
<a class="previewTabLink" id="contactTabLink" rel="#contactOverlay">CONTACT</a>

When somebody clicks the
contactTab, it should trigger a click event on
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?


I have changed the selectors to have #'s but it still won't fire the function.

Answer Source

Your selector is not correct.

It should be this:

$('#contactTab').click(function() {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download