I have a problem. I have a tabs script and I have the code to link to a specific tab from outside the DIV tag. I need to link to all 3 tabs, though, not just 1 like I have now. What do I need to change in the Javascript part so that I can link to 3 tabs not just 1?
HTML Code:
[CODE]
<div id=”test_tabs” class=”ui-tabs”>
<ul>
<li><a href=”#tab1″>Tab 1</a></li>
<li><a href=”#tab2″>Tab 2</a></li>
<li><a href=”#tab3″>Tab 3</a></li>
</ul>
<div id=”tab1″>Content 1</div>
<div id=”tab2″>Content 2</div>
<div id=”tab3″>Content 3</div>
</div>
<br/>
<hr/>
<div id=”show_1″>Outside link to Tab 1</div>
<div id=”show_2″>Outside link to Tab 2</div>
<div id=”show_3″>Outside link to Tab 3</div>
Javascript Code:
[CODE]
<script>
$(function() {
$(‘#test_tabs’).tabs();
$(‘#show_3’).click(function(event) {
$(‘#test_tabs’).tabs(‘select’, 2);
}).css({
color : ‘blue’,
cursor : ‘pointer’
});
});
</script>
I tried changing it to:
[CODE]
<script>
$(function() {
$(‘#test_tabs’).tabs();
$(‘#show_1’).click(function(event) {
$(‘#test_tabs’).tabs(‘select’, 0);
$(‘#show_2’).click(function(event) {
$(‘#test_tabs’).tabs(‘select’, 1);
$(‘#show_3’).click(function(event) {
$(‘#test_tabs’).tabs(‘select’, 2);
}).css({
color : ‘blue’,
cursor : ‘pointer’
});
});
</script>
But that didn’t work ?