Hello all, I have the following problem:
I want to create a webpage in which I can use the JQuey tabs both by a side-bar and by the upper button-bar of the Jquery tabs itself. I am using the following code:
title here $(document).ready(function(){ $("#datepicker").datepicker(); }); $(document).ready(function() { $("#tabs").tabs(); }); $("select2").click(function() { // bind click event to link $("$tabs").tabs("select", 1); // switch to third tab return false; });
<body>
<div id="container">
<div id="row">
<div id="leftsubcontainer"><div class="column-in">
<h4>rev0.1</h4>
<p>medewerkernaam</p>
<br/>
<div type="text" id="datepicker"></div>
<br/><br/>
<br/><br/>
<p>log out</p>
<button id="select2">kies derde</button>
<br/><br/>
</div></div>
<div id="rightsubcontainer"><div class="column-in">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Nunc tincidunt</a></li>
<li><a href="#tabs-2">Proin dolor</a></li>
<li><a href="#tabs-3">Aenean lacinia</a></li>
</ul>
<div id="tabs-1">
<p>tekst1</p>
</div>
<div id="tabs-2">
<p>tekst 2</p>
</div>
<div id="tabs-3">
<p>tekst 3</p>
</div>
</div>
</div></div>
</div>
</div>
</body>
The problem is, that, whenever I click on the button, the tabs are not changing (i.e. it does not select the right tab). Does anyone of you know what I have been doing wrong?
Hope to hear from you all,
kind regards, Jeroen
-
You have a few typos and issues with your selectors that's getting in the way. Repalce your javascript code with the following
$(document).ready(function() { var $tabs = $("#tabs").tabs(); $("#select2").click(function() { // bind click event to link $tabs.tabs("select", 1); // switch to second tab return false; }); });
That should work fine.
0 comments:
Post a Comment