jquery ui tabs showing exception when selecting using jquery? -



jquery ui tabs showing exception when selecting using jquery? -

i've simple ui tabs this

<div id="tabs"> <ul><li><a href="#tabs-1">single</a></li><li><a href="#tabs-2">matchmaker</a></li></ul></div>

later utilize jquery alternative select tab

<script type="text/javascript"> $(document).ready( function() { var role = 1; //some value, value changes , i'm sure has value. $("#tabs").tabs("option", "selected", role); } ); </script>

i've tried $("#tabs").tabs("option", "selected", 0);

but no luck.. may error?

you should this:

$(document).ready( function() { var role = 1; //some value, value changes , i'm sure has value. $("#tabs").tabs({ selected: role }); } );

fiddle here: http://jsfiddle.net/6rb2w/1/

edit - there problem markup: @ fiddle working: http://jsfiddle.net/6rb2w/11/

<div id="tabs"> <ul><li><a href="#tabs-1">single</a></li><li><a href="#tabs-2">matchmaker</a></li></ul> <div id="tabs-1"> <p>proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. curabitur nec arcu.</p> </div> <div id="tabs-2"> <p>morbi tincidunt, dui sit down amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. duis scelerisque molestie turpis.</p> </div> </div> $(document).ready( function() { var role = 1; //some value, value changes , i'm sure has value. $("#tabs").tabs(); alert('now alter selected tab'); $("#tabs").tabs( "select", role ); } );

the problem first div must wrap around other 2 divs otherwise when swtich tab $("#tabs").tabs( "select", role ); gives error

jquery jquery-ui-tabs

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -