我嘗試使用Bootstrap 3 collapse函數來設計一個表來顯示兩個不同的HTML表單。有一個問題,如果我單擊form1,form1可以正確顯示,但如果我單擊form2,form2將顯示在form1下。Bootstrap 3 collapse「data-parent」not working
我想在打開form2時,form1會關閉並只顯示form2.我嘗試使用data-parent,但它仍然不起作用。
我用下面的HTML代碼:
<div id="myAccordion" >
<table id="edit" class="table table-striped table-bordered table-hover table-condensed table-nonfluid1 thumbnail" >
<tbody>
<tr>
<td width=50%><button type="button" class="btn btn-info btn-lg" data-toggle="collapse" data-target="#form1" data-parent="#myAccordion">form1</button></td>
<td width=50%><button type="button" class="btn btn-primary btn-lg" data-toggle="collapse" data-target="#form2" data-parent="#myAccordion">form2</button></td>
</tr>
<tr>
<td colspan="2">
<div id="form1" class="collapse">
. <form method="POST" novalidate="novalidate">
<div class="form-group">
<label for="number1" class="control-label ">number1</label>
<input type="text" class="form-control" id="number1" name="number1" >
<span class="help-block"></span>
</div>
<div class="form-group">
<label for="number2" class="control-label ">number2</label>
<input type="text" class="form-control" id="number2" name="number2" >
<span class="help-block"></span>
</div>
<div class="form-group">
<label for="number3" class="control-label ">number3</label>
<input type="text" class="form-control" id="number3" name="number3" >
<span class="help-block"></span>
</div>
<button type="submit" class="btn btn-success btn-block">submit</button>
</form>
</div>
<div id="form2" class="collapse">
. <form method="POST" novalidate="novalidate">
<div class="form-group">
<label for="newinfo" class="control-label ">info</label>
<textarea class="form-control" rows="3" id="newinfo" name="newinfo"> </textarea>
<span class="help-block"></span>
</div>
<button type="submit" class="btn btn-success btn-block">submit</button>
</form>
</div>
</td>
</tr>
</tbody>
</table>
</div>
在我的代碼什麼問題?
小提琴是必須爲HTML問題 – q0re 2015-02-23 07:10:51
崩潰是工作,而是「數據父母「不起作用 – Roy12345678 2015-02-23 07:22:53