i need tell page when loads jquery tab use selected / active tab -- i've tried solutions i've found here, , have searched elsewhere extensively, i'm handicapped knowing little js , jquery. i'm under severe time crunch, if can me extremely grateful.
here code: in page head section, have:
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery-ui.js"></script> <script type="text/javascript" src="jquery-tabs.js"></script>
and
<script>$(document).ready(function() $("#tabs > ul").tabs();</script>
in body, have tab div set up, tabs li items (sample below), , works fine except can't seem select tab programmatically.
li class="tabstuff"><a class="tabstuff" href="#tab1"><span>first tab</span></a></li>
i haven't been able force second tab select on page load when i've tried using code saw in 1 of question posts:
first got index of tab wanted (which know worked, because displayed myself using alert box), using this:
var index = $('#tabs a[href="#tab2"]').parent().index();
then tried each of these 2 methods (separately):
$("#tabs").tabs("option", "active", index);
i tried:
$('#tabs').tabs('select', index);
nothing works, , don't know enough jquery see i'm going wrong.
a second issue how tell function tab select , display active on page load. can pass in post or variable, i've tested code found says can use this:
var qry = window.location.search; if (qry.indexof("showlist=yes") > 0) { //i added alert box here , never got triggered }
to check post or variable, , doesn't seem work either.
my web page builds html via php, don't yet understand enough triggering jquery function know how anywhere except on page load or onclick/onchange event.
thanks can give!
in order select different tab first have do
$("#tabs").tabs({ active: 2 });
where 2
can changed index want
Comments
Post a Comment