I want to select “Algeria” as default selected value in drop down list.I am fetching countrylist from database using handler ( LoadCountryList.ashx ) in JSON data format and binding it to dropdownlist on aspx page using Jquery’s $.getJSON precedure given below
function AddOptions(objSelect)
{
var URL ="~/LoadCountryList.ashx";
$.getJSON(URL,function(countries){
$.each(countries,function(){
var vCountry = this['Country'];
$(objSelect).append($("<option></option>").val(this['ID']).html(vCountry));
});
});
}
and finally i tried to set its default value “Algeria”.
$(objSelect).find("option[text='Algeria']").attr("selected","selected");
OR
$(objSelect).find("option[value='3']").attr("selected","selected");
but its not worked.Does anyone suggest me how to do it.

UPDATE:
Also i want to show waiting message like Loading… until it get complete country list from database.
To do it by value, you can just use the
val()(docs) method.By text content, safest is to use the
filter()(docs) method.EDIT: Make sure you’re doing it inside the callback to the
getJSON()call.