I found a fiddle that has a feature I want (http://jsfiddle.net/R5sSh/), but I can't get it to work on a test page with newer jquery 2.X and jquery mobile 1.4.X.
My fiddle: http://jsfiddle.net/skfneasfbif/m11v6tef/
My example page, created from my fiddle:
<html>
<head>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs({
select: function(event, ui) { console.log("Tab selected"); }
});
$("#tabs-1 > #subtabs").tabs({
select: function(event, ui) { console.log("subTab selected"); }
});
});
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Tab1</a></li>
<li><a href="#tabs-2">Tab2</a></li>
</ul>
<div id="tabs-1">
<p>Console.log shows 1 message : "Tab selected"</p>
<div id="subtabs">
<ul>
<li><a href="#subtabs-1">Subtab1</a></li>
<li><a href="#subtabs-2">Subtab2</a></li>
</ul>
<div id="subtabs-1">
<p>Console.log shows 2 messages : "Subtab selected" & "Tab selected". I just want the Subtab selected.</p>
</div>
<div id="subtabs-2">
<p>Console.log shows 2 messages : "Subtab selected" & "Tab selected". I just want the Subtab selected.</p>
</div>
</div>
</div>
<div id="tabs-2">
<p>Console.log shows 1 message : "Tab selected"</p>
</div>
</div>
</body>
</html>
which renders without the tabs, and just contains the text, and doesn't do anything when the links are clicked.
Whats wrong with my test page? Is there a debugger that would have shown me my error?
Edit: I've updated the javascript, but it still doesn't render properly. Theres a test page in my comment.