dongzheng4556 2013-05-31 06:17
浏览 58
已采纳

我必须使用PHP发布选择更改选项,但是选择正由JQuery转换为ul li

I am using styled select dropdown, from here:

I want to post the selected option in order to render some data for other dropdowns.

The problem is the the

 onChange="this.form.submit()"

is not working, as the JQuery changes select options to ul > li... Any solution will be appericiated.. Either to post on the same, or to have an alternative JQuery select which does not convert select to ul li.

select name="districtid" id="districtid" class="cd-select" > onChange="this.form.submit();" >

                   <option value="" selected>Select District</option>
                  <?php do {
                  ?>
                  <option value="<?php echo >$row_district['id'];?>"
                      <?php
                  if(isset($_GET['districtid']))

{ $pdistrict = $_GET['districtid']; if ($row_district['id'] == $pdistrict ) echo "selected";} ?>>

                      echo $row_district['name']; 

                       ?>
                   </option>

                   <?php } while ($row_district = >mysql_fetch_assoc($district)); ?>
  • 写回答

1条回答 默认 最新

  • douluo5937 2013-05-31 08:01
    关注

    try this

    from line 143-151 in jquery.dropdown.js update with the below code where myform is your form's id.. but it will not preserve the dropdown state as the page will load and if you want to preserve the drop down value as selected then you can use cookie.

    this.opts.on( 'click.dropdown', function() {
                if( self.opened ) {
                    var opt = $( this );
                    self.options.onOptionSelect( opt );
                    self.inputEl.val( opt.data( 'value' ) );
                    self.selectlabel.html( opt.html() );
                    if ($("#myform").length == 1) {
                    $("#myform").submit();//submitting myform
                    }
                    self.close();
                }
            } );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥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#的问题,如何解决?