Reputation: 1779
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
Upvotes: 0
Views: 75
Reputation: 1896
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 :)
Upvotes: 0
Reputation: 19228
$('#make article > a, #latestInner article > a').click(function (e) {
("#make article h4 a").trigger('click');
}
Upvotes: 1
Reputation: 318302
jQuery's trigger()
will do that :
$('#make article > a, #latestInner article > a').click(function() {
$('#make, #latestInner, #models').find('article h4 a').trigger('click');
});
Upvotes: 2