Вы также можете попробовать этот маленький кусочек JavaScript/JQuery код
//Force click method.
//You can directly put the force click method in the click event handler
//But I prefer this way for readability and ease of maintenance.
function toggleClick(elementSelector) {
$(elementSelector).click();
}
//Delegated click event on the tab-content section
//This event will handle all Anchor tags within tab content
//All you have to do with the markup is add a data-id on the tabs i.e **li > a** which is located in the UL tag
$(".tab-content").on("click", function(e) {
if (e.target && e.target.tagName === "A") {
toggleClick("[data-id='" + e.target.hash + "']");
//Without toggleClick method
//$("[data-id='" + e.target.hash + "']").click();
}
});
Я также создал рабочую Fiddle для вас, чтобы работать вокруг.