tags:

views:

25

answers:

2

i have 2 lists.

country and region

i want to lock the region list. when 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?

A: 

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 :)

yoda
didnt understand actually although i read the documentation.if i reformulate: how can i make a select list unclickable?
never_had_a_name
ah, didn't mentioned you wanted a select list .. in that case, @Greg W answer is more suitable for you.
yoda
+2  A: 

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');
Greg W