lock the region list?
i have 2 lists.
country and region
i want to lock the region list. when 开发者_Go百科i choose country i will use jquery to get the region list for that country. but meanwhile i want the region list to be locked and will be interactive first when the region list for that country is retrieved.
how do i do this with jquery?
Your question is a little unclear to me but it sounds like you are wanting to disable a drop-down list. If thats the case, you could try this.
//Disable code:
$('select#region').attr('disabled', 'disabled');
//Enable code:
$('select#region').removeAttr('disabled');
Use jQuery's bind and unbind functions, like this :
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);
});
Hope you understand :)
精彩评论