download20151010 2011-05-03 10:27
浏览 63

如何根据另一个下拉列表将dropdownlist更改为textbox,反之亦然

I am developing an application where I am using country (dropdown list) and state (dropdown list).

The question is when 1 select country, it's states will be populated in state dropdownlist but the state list is only provided for USA and other countries are not provided so they have to type in.

So how to change state input type (TEXTBOX OR DROPDOWNLIST) based on USA (country). That is

If USA -DROPDOWNLIST Else Other Countries -TEXTBOX
  • 写回答

5条回答 默认 最新

  • dsbezji539113152 2011-05-03 10:33
    关注

    I would make is a select box by default, then use this jQuery to alter it.

    if($(#country_select).val() != 'USA'){
      $('#selectbox').attr('type', 'textbox');
      $('#selectbox option').remove();
    }
    

    NOTE

    This is a very simple solution, and requires that the default value is USA. I think there is enough info there to build a more robust solution.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向