Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 锁定区域列表?_Jquery_Html - Fatal编程技术网

Jquery 锁定区域列表?

Jquery 锁定区域列表?,jquery,html,Jquery,Html,我有两张清单 国家和地区 我想锁定区域列表。当我选择country时,我将使用jquery获取该国家的地区列表。但与此同时,我希望区域列表被锁定,并在检索该国家的区域列表时首先进行交互 如何使用jquery实现这一点?使用jquery的绑定和取消绑定函数,如下所示: var country = function () { // unbinds itself $('a.country').unbind('click', country); // ... the rest of y

我有两张清单

国家和地区

我想锁定区域列表。当我选择country时,我将使用jquery获取该国家的地区列表。但与此同时,我希望区域列表被锁定,并在检索该国家的区域列表时首先进行交互


如何使用jquery实现这一点?

使用jquery的绑定和取消绑定函数,如下所示:

var country = function () {
   // unbinds itself
   $('a.country').unbind('click', country);
   // ... the rest of your code, including ajax request
   // wich will "rebind" the function again when finished

};

// bind initially the function to the handler
$('a.country').bind('click', country);

});

希望您理解:)

您的问题对我来说有点不清楚,但听起来您想禁用下拉列表。如果是这样,你可以试试这个

//Disable code:
$('select#region').attr('disabled', 'disabled');

//Enable code:
$('select#region').removeAttr('disabled');

虽然我读了文档,但实际上我不明白。如果我重新表述:我如何才能使选择列表不可查找?啊,没有提到你想要选择列表。。在这种情况下,@Greg W answer更适合您。