1 回答

TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超2個(gè)贊
您應(yīng)該使用 javascript 進(jìn)行不可見(jiàn)的單選框輸入,因?yàn)槟鸁o(wú)法發(fā)送到 PHP HTML DOM,因此您需要使用表單進(jìn)行操作。
所以為了快速幫助:
<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 關(guān)注
- 89 瀏覽
添加回答
舉報(bào)