I am populating country dropdownlist from a database. I need to select a value from dropdown list and assign it to textbox by using Javascript.
Code:
var textboxId = document.getElementById("txtCountry");
var dropdownListId =document.getElementById("ddlLocation");
var e = document.getElementById("ddlLocation");
var strUser = e.options[e.selectedIndex].value;
document.getElementById(textboxId).value = strUser;
document.getElementById(textboxId).focus();
by doing this I am getting error. Any solutions?