1 回答
TA贡献1784条经验 获得超2个赞
您应该使用 javascript 进行不可见的单选框输入,因为您无法发送到 PHP HTML DOM,因此您需要使用表单进行操作。
所以为了快速帮助:
<form action="post.php" method="post">
<div class="from-step-content">
<ul class="nav nav-tabs nav-tabs-bordered" role="tablist" name="selected-item">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#item-one">
<input type="radio" name="item" value="1" style="display:none;"/>
<div class="nav-tabs-icon">
<img src="images/1.png" alt="icon">
<img src="images/1-color.png" alt="icon">
</div>
<span>Item One</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#item-two">
<input type="radio" name="item" value="1" style="display:none;"/>
<div class="nav-tabs-icon">
<img src="images/2.png" alt="icon">
<img src="images/2-color.png" alt="icon">
</div>
<span>Item Two</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#item-three">
<input type="radio" name="item" value="1" style="display:none;"/>
<div class="nav-tabs-icon">
<img src="images/3.png" alt="icon">
<img src="images/3-color.png" alt="icon">
</div>
<span>Item Three</span>
</a>
</li>
</ui>
</div>
<button>Submit</button>
</form>
<script>
$(document).ready(function(){
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('input[type="radio"]').prop("checked", false);
$(e.target).find('input[type="radio"]').prop("checked", true);
})
});
</script>
- 1 回答
- 0 关注
- 67 浏览
添加回答
举报