1

I have the bootstrap Country picker working (using a div tag instead of the select tag provided on their website). However, I can't get the state picker to show state options based on country selected.

Here are the files I have linked:

<!-- Bootstrap Form Helpers -->
<link href="http://bootstrapformhelpers.com/assets/css/bootstrap-formhelpers.min.css" rel="stylesheet" media="screen">

<!-- jQuery -->
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>

<!-- Bootstrap -->
<script src="http://bootstrapformhelpers.com/assets/js/bootstrap.min.js"></script>

<!-- Bootstrap Form Helpers -->
<script src="http://bootstrapformhelpers.com/assets/js/bootstrap-formhelpers.min.js"></script>

and here is the code for both the countries and states.

<div class="bfh-selectbox bfh-countries" data-country="US" data-flags="true">

<div class="bfh-selectbox bfh-states" data-country="countries_states1" data-state=" ">

As I said, the countries work fine but the states do not populate anything and I need them to populate in relation to the country selected.

Any help is appreciated!

4

1 回答 1

2

我在网上找到了答案,以防其他人正在寻找。删除上面的两个 div 并添加:

<div id="countries_states2" class="bfh-selectbox bfh-countries" data-country="US" data-flags="true">
  <input type="hidden" value="">
  <a class="bfh-selectbox-toggle" role="button" data-toggle="bfh-selectbox" href="#">
    <span class="bfh-selectbox-option input-medium" data-option=""></span>
    <b class="caret"></b>
  </a>
  <div class="bfh-selectbox-options">
  <div role="listbox">
    <ul role="option">
    </ul>
    </div>
  </div>
</div>
<div class="bfh-selectbox bfh-states" data-country="countries_states2">
  <input type="hidden" value="">
  <a class="bfh-selectbox-toggle" role="button" data-toggle="bfh-selectbox" href="#">
    <span class="bfh-selectbox-option input-medium" data-option=""></span>
    <b class="caret"></b>
  </a>
  <div class="bfh-selectbox-options">
  <div role="listbox">
    <ul role="option">
    </ul>
    </div>
  </div>
</div>

如果要保留标志图标,请将 data-flags="true" 添加到顶部的第一个 div

于 2015-04-13T18:13:44.793 回答