Changing the URL of a remote tab's content
The url
method is used to change the URL that the AJAX tab retrieves its content from. Let's look at a brief example of these two methods in action. There are also a number of properties related to AJAX functionality.
Add the following new <select>
element after the Tabs widget in tabs17.html
:
<select id="fileChooser"> <option value="remoteTab1.txt">remoteTab1</option> <option value="remoteTab2.txt">remoteTab2</option> </select>
Then change the final <script>
element to the following:
<script> $(document).ready(function($){ $("#myTabs").tabs(); $("#fileChooser").change(function() { $("#myTabs").tabs("option", "active", "2"); $("#myTabs").find("ul>li a").attr("href", $(this).val()); $("#myTabs").tabs("load", "active"); }); }); </script>
Save the new file as tabs18.html
. We've added a simple <select>
element to the page that lets you choose the content...