【发布时间】:2015-05-25 12:40:04
【问题描述】:
我正在尝试保存 Bootstrap 导航选项卡的活动状态并将它们作为隐藏字段发送到表单中,以便我可以在下次加载页面时保持活动状态。
我的导航标签是 ;
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" index="1" class="active"><a href="#text-only" aria-controls="text-only" role="tab" data-toggle="tab">Text only</a></li>
<li role="presentation" index="2"><a href="#with-pic" aria-controls="with-pic" role="tab" data-toggle="tab">With Pic</a></li>
<li role="presentation" index="3"><a href="#gallery" aria-controls="gallery" role="tab" data-toggle="tab">Gallery</a></li>
<li role="presentation" index="4"><a href="#map-view" aria-controls="map-view" role="tab" data-toggle="tab" >Map View</a></li>
</ul>
我的内容导航选项卡是;
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="text-only">
</div>
<div role="tabpanel" class="tab-pane" id="with-pic">
</div>
<div role="tabpanel" class="tab-pane" id="gallery">
</div>
<div role="tabpanel" class="tab-pane" id="map">
</div>
</div>
我想通过表单输入字段发送活动状态
<form action="" method="get" name="search_form">
<input type="hidden" name="active_nav_tab" value="">
<input type="hidden" name="active_nav_content" value="">
<input type="submit" value="submit">
</form>
一个逻辑是通过 Jquery 获取活动选项卡,但我将在表单字段中传递的值是什么。我被困住了。非常感谢任何形式的帮助
【问题讨论】:
-
每个标签都有一个
id,为什么不使用它呢? -
如果我错了,请纠正我,但是您是否使用 php 并希望将表单状态或值发送到另一个页面,您将在该页面中使用来自的值设置导航设置上一页?
-
您的意思是获取活动选项卡窗格的 ID 并将其保存在表单字段中?下次通过 php 显示?
-
是的,shayan 这正是我想要做的
-
也许你应该看看 html5 本地存储?无需强调服务器 :) diveintohtml5.info/storage.html
标签: jquery