dsl36367 2017-03-26 06:18
浏览 36

php和javascript中的下拉框

I am looking for a way to create a drop down list depending on what the user chooses. If the user picks the package of one profile the the output will give the user a drop down list with 1 field if the user chooses two profiles the output will give the user a drop down with 2 fields. The code recently displays just one dropdown even if the user chooses the second option

                    <ul class="dropdown-menu <?= empty($business) ? 'hidden' : '' ?>" aria-labelledby="business_list">
                    <?php foreach ($business as $key => $item) : ?>
                        <li><?= Html::a($item->name, ['social-manager/profiles', 'b' => $key]) ?></li>
                    <?php endforeach; ?>
                </ul>
  • 写回答

2条回答 默认 最新

  • dream989898 2017-03-26 06:28
    关注

    I will assume you are using jQuery.You will need to define an number variable var length based on user selection. If user selects option 1 then var length=1,if user selects option 2 then var length=2; Th for loop below should generate the options based on user selection.

    for(var x=0;x<length;x++){
    .....
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?