0

I have a click function on the following element:

$('#make article > a, #latestInner article > a').click(function (e) {...});

Now I want to bind the clicking of the above to the following:

$('#make article h4 a, #latestInner article h4 a, #models article h4 a').click(function (e) {...});

so that clicking on:

#make article > a, #latestInner article > a

will be as if I have clicked on:

#make article h4 a, #latestInner article h4 a, #models article h4 a

3 Answers 3

2

jQuery's trigger() will do that :

$('#make article > a, #latestInner article > a').click(function() {
    $('#make, #latestInner, #models').find('article h4 a').trigger('click');
});
Sign up to request clarification or add additional context in comments.

Comments

1
$('#make article > a, #latestInner article > a').click(function (e) {    
 ("#make article h4 a").trigger('click');    
}

Comments

0

Try this:

$('#make article > a, #latestInner article > a').click(function (e) {
    $('#make article h4 a').click();
    $('#latestInner article h4 a').click();
    $('#models article h4 a').click();
});

$('#make article h4 a, #latestInner article h4 a, #models article h4 a').click(function (e) {...});

Hope it helps :)

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.