Retrieving index of Jquery Tabs

Posted by Kelvin on Stack Overflow See other posts from Stack Overflow or by Kelvin
Published on 2009-08-06T21:01:44Z Indexed on 2010/06/16 5:02 UTC
Read the original article Hit count: 238

Filed under:
|

Hello I am trying to get index of current selected tab. Alert(ui.index) returns "undefined". Any idea why?

thanks

    <script>
	$(document).ready(function(){
		var $tabs = $("#apttabs > ul").tabs();

		$tabs.bind('tabsselect', function(event, ui) {
			alert(ui.index);
		});
	});
</script>


<div id="apttabs">
    <ul>
    	<li><a href="#fragment-1"><span>tab1</span></a></li>
    	<li><a href="#fragment-2"><span>tab1</span></a></li>
    	<li><a href="#fragment-3"><span>tab1</span></a></li>
        </ul>

    <div id="fragment-1">content 1</div>
    <div id="fragment-2">content 1</div>
    <div id="fragment-3">content 1</div>

</div>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about tabs