Bootstrap4-使用复选框折叠段落

时间:2017-08-09 21:41:49

标签: html5 bootstrap-4

在下面的代码中,Bootstrap4有奇怪的行为



.form-group .custom-control{
    margin-left: 15px;
}

<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<form>
<div class="form-group row has-success">
   <label class="custom-control custom-checkbox">
      <input id="father_dead_or_alive" type="checkbox" class="custom-control-input" data-toggle="collapse" data-target="#father_message">
      <span class="custom-control-indicator"></span>
      <span class="custom-control-description">AAAAAAAAAAAAAAAA</span>
   </label>
<p id="father_message" class="collapse form-text text-muted">BBBBBBBBBBBBB</p>
                                </div>
                            </form>
&#13;
&#13;
&#13;

选中此框时,检查标志不会显示! 我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您可以尝试移动:

data-toggle="collapse" data-target="#father_message"

...从输入到description范围。