1

I have the following element:

  <a href="#" class='popup register'>Register</a>

and I want to trigger a clic action on this, how do I do this? I tried doing:

$('.popup .register').trigger('click');

but it didn't work

0

1 Answer 1

3

Remove the space between the selectors.

$('.popup.register').trigger('click');

.popup .register means that trigger click event on the element with class register which is a child of element with class popup. So in your particular scenario this won't work as they are both on the same element.

Fiddle Sample

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.