I got 3 Tabs Visit, History, Files. The navigation is like this
<ul>
<li>
<a id="nav_visit" href="#tab_visit" data-g-toggle="tab">Visit</a>
</li>
<li>
<a id="nav_history" href="#tab_history" data-g-toggle="tab">Visit</a>
</li>
<li>
<a id="nav_files" href="#tab_files" data-g-toggle="tab">Visit</a>
</li>
</ul>
Also i got a link to edit some stuff in the tabs like this
<div><a id="editwithtab" href="edit?id=<?php echo $id;?>&tab=tab_visit">EDIT</a></div>
When you click one of the li Tabs it adds the Tab ID to a hidden field for some other reasons.
$(document).on('click', '#nav_visit', function() {
$('#redirecttab').val('tab_visit');
});
$(document).on('click', '#nav_history', function() {
$('#redirecttab').val('tab_history');
//$('#editwithtab').replace("tab=tab_visit", "tab=tab_history");
//tab= tab_visit or tab_history(in this case it wont matter) or tab_files
});
$(document).on('click', '#nav_files', function() {
$('#redirecttab').val('tab_files');
});
What I want it to do is also change the parameter "tab=" in the edit link so that it can redirect to the edit page with the same tab open.
I found other posts about this replace but none had a php echo in the link.
Any help?
You can try this:
$('#editwithtab').attr('href', function(i, href) {
return href.split("&")[0] + "&tab=tab_history";
});
I hope this will help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.