jquery - is it possible to use Tabs without using anchor tag and id? -
i generate dynamic tabs. anchor tags not have id div tags wont have id.
this try doesn't work.
<script> $(function () { $("#tabs").tabs(); $("#tabs ul.super li a").each(function (index) { $(this).click(function () { $("#tabs").tabs("select", index); }); }); }); </script> <div id="tabs"> <ul class="super"> <li><a>title 1</a></li> <li><a>title 2 </a></li> </ul> <div> content1 </div> <div> content2 </div> </div>
how can make work that?
it workind code. dynamicaly add tab's , a's
<div id="tabs"> <ul class="super"> <li><a>title 1</a></li> <li><a>title 2 </a></li> </ul> <div> content1 </div> <div> content2 </div> </div> <script> $(function () { $("#tabs ul.super li a").each(function (index) { $(this).attr("href", "#spec" + index.tostring()); }); $("#tabs div").each(function (index) { $(this).attr("id", "spec" + index.tostring()); }) $("#tabs").tabs(); }); </script>
Comments
Post a Comment