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?
If listCountry is an existing select element then document.getElementById("listCountry").value 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 document.getElementById("listCountry") that returns null? If that's the case then listCountry simply does not exist. (Maybe there's a misspelling somewhere.)
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?
Well, uh, if I change the <% code... %> to something appropriate it works in Chrome and Firefox though not in IE, but you should really take a closer look at your HTML code.
Bookmarks