Reputation: 764
I've tried chaining and nesting, but possibly in the wrong style is there a more efficient way to execute these two lines?
$('#pub1, #pub1Tab').addClass('active');
$('#pub1').parent().addClass('active');
Upvotes: 1
Views: 123
Reputation: 2624
Try to use jquery parent selector
$('#pub1, #pub1:parent, #pub1Tab').addClass('active');
Upvotes: 1