禁用jQuery Mobile中的另一个选择中的一个选择 [英] Disabling a select from another select in jQuery Mobile

查看:80
本文介绍了禁用jQuery Mobile中的另一个选择中的一个选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery Mobile开发应用程序,并且具有以下选择形式

<label for="estado_toma">Estado de la Toma</label>
<select id="estado_toma" name="estado_toma" data-native-menu="false">
    <option data-placeholder="true">Estado de la Toma</option>
    <option value="1">Buen Estado</option>
    <option value="2">Caja Dañada</option>
    <option value="3">Sin Tapa</option>
    <option value="4">No Hay</option>
</select>

当您选择此选项下的no选项other select disable me时,我想这样做,而当您选择其他选项时,其他select可用.

非常感谢他们能给我的帮助,

问候.

解决方案

要禁用选择菜单:

 $(".selector").selectmenu("disbale");
 

要启用选择菜单:

$(".selector").selectmenu("enable");

收听change事件:

$("#estado_toma").on("change", function () {
  var sel_val = $(this).val();
  if (sel_val == 4) {
    $("#otros").selectmenu("disable");
  } else {
    $("#otros").selectmenu("enable");
  }
});

演示

I am developing an application in jQuery Mobile and in a form I have the following select

<label for="estado_toma">Estado de la Toma</label>
<select id="estado_toma" name="estado_toma" data-native-menu="false">
    <option data-placeholder="true">Estado de la Toma</option>
    <option value="1">Buen Estado</option>
    <option value="2">Caja Dañada</option>
    <option value="3">Sin Tapa</option>
    <option value="4">No Hay</option>
</select>

I want to do that when you choose the no option other select disable me that are below this and when you choose the other options become available those other select.

  Greatly appreciate the help they can give me,

  regards.

解决方案

To disable a selectmenu:

$(".selector").selectmenu("disbale");

To enable a selectmenu:

$(".selector").selectmenu("enable");

Listen to change event:

$("#estado_toma").on("change", function () {
  var sel_val = $(this).val();
  if (sel_val == 4) {
    $("#otros").selectmenu("disable");
  } else {
    $("#otros").selectmenu("enable");
  }
});

Demo

这篇关于禁用jQuery Mobile中的另一个选择中的一个选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆