ReFreezed

Well, is the element with the id listCountry a <select> or other type of input element?

(Also, JavaScript is not the same as Java.)

cavidan29

listCountry is the id of 1st listbox (<select>) and listCountryRegion is the id of 2nd which I would like to populate based
on the 1st one.
I am developing my project using Java web technologies so I need to work with JQuery, Ajax, HTML, Javascript.
Variable selectedCountryName does not get country name from the listbox and I am wondering why? Maybe page is not
refreshed?

ReFreezed

If listCountry is an existing select element then [FONT=courier new]document.getElementById("listCountry").value[/FONT] should be a string no matter what. If listCountry would be another kind of element than a select element, for example a paragraph, then the value property should be undefined, not null. Are you sure it's not [FONT=courier new]document.getElementById("listCountry")[/FONT] that returns null? If that's the case then listCountry simply does not exist. (Maybe there's a misspelling somewhere.)

cavidan29

No, there is no misspelling. When I select the country name from the drop down list function does not get the name but when I click on submit button it gets. So I am wandering why it happens?