I have the following piece of code. Whenever, user clicks a button, I need to switch tabs. I see the tab getting switched just for a moment but it immediately switches back to the first tab. Why is that? How do I solve this problem?
<div id="tabs">
<ul>
<li><a href="#tabs-1">A</a></li>
<li><a href="#tabs-2">B</a></li>
<li><a href="#tabs-3">C</a></li>
<li><a href="#tabs-4">D</a></li>
</ul>
<div id="tabs-1">
<div class="input">
<form>
<fieldset>
<legend>Data source</legend>
Blah blah
</fieldset>
<fieldset>
<legend>Legend</legend>
<div id="accordion">
<h4>Check sequence</h4>
<div>
<button id="submitCheckSequence">Test!</button>
</div>
<h4>Random section</h4>
<div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<div id="tabs-2">
<p>Blah</p>
</div>
<div id="tabs-3">
<p>Blah</p>
</div>
<div id="tabs-4">
<textarea rows="4" cols="50" readonly>
Blah
</textarea>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#tabs").tabs();
$("#accordion").accordion();
$("#submitCheckSequence").click(function () {
$("#tabs").tabs("option", "active", 3);
});
});
</script>