e.g if i send this link below to someone or use it like an hyperlink i would like it to load the page and select only the News tab.
You can try to use HTML5 data- attributes.
The code:
<script>
$(document).ready(function () {
$('#tabs').tabs();
$('.open-tab').click(function () {
$('#tabs').tabs("option", "active", $(this).data("tab-index"));
});
});
</script>
<form id="form1" runat="server">
<a href="#description" class="open-tab" data-tab-index="0">Open News Tab</a>
<a href="#video" class="open-tab" data-tab-index="1">Open Animals Tab</a>
<a href="#video" class="open-tab" data-tab-index="2">Open Cities Tab</a>
<div id="tabs">
<ul>
<li><a href="#News">News</a></li>
<li><a href="#Animals">Animals</a></li>
<li><a href="#Cities">Cities</a></li>
</ul>
<div id="News">
This is new
</div>
<div id="Animals">
This is animal
</div>
<div id="Cities">
This is city
</div>
</div>
</form>
The result:
Best regards,
Sam
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Participant
1860 Points
707 Posts
Re: how to use a direct link(href) to a specific jqueryUI tab?
Oct 25, 2019 09:14 AM|samwu|LINK
Hi naijacoder74,
You can try to use HTML5 data- attributes.
The code:
The result:
Best regards,
Sam
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.