Rename jQuery UI tab with jQuery
I have 3 tabs:
<div id="tabs"> <ul> <li><a href="#tabs-1">Tab1</a></li> <li><a href="#tabs-2">Tab2</a></li> <li><a href="#tabs-3">Tab3</a></li> </ul> <div id="tabs-1"></div> <div id="tabs-2"></div> <div id="tabs-3"></div> </div> with this jQuery
<script type="text/javascript"> $(document).ready(function () { var $tabs = $("#tabs").tabs({ select: function (e, ui) { } }); }); </script> I would like, when performing some operation on the first and third tabs, the label of the second tab changes its name from "Tab2" to "Other text"
I tried several ways to find on Google, but any work.
Thanks,
+4
5 answers
Alternatively, for anyone who wants to change the text of a specific tab, "# tabs-2" in this case:
$('#tabs [aria-controls=tabs-2] a span').text("New Label") Please note that this depends on the current formatting of jquery-ui tabs and may need to be changed if the template changes in future versions.
+2