Hi, I have tried so many different things but nothing seems to be working.
I have a screen with multiple input fields that I want to clear the values of after the user clicks OK on an alert box. This is working with the exception of 1 of my fields - a dropdown. It is actually clearing the values because when writing to the DB the values are cleared but it is still showing on the page.
When a particular field is cleared manually by the user, they are promoted to confirm if they intend to clear ALL inputs. If they answer Yes, I call an Ajax function from my javascript. This Ajax function calls a stored procedure. If this all returns as successful then I want to clear all the screen values - as I said this works for all except 1.
Below that I am trying to clear the dropdown by setting the selectedIndex to -1.
But on the screen, it is still showing the previously selected option.
Any other suggestions ? I have tried quite a few things..... setting it to selectedIndex = "0" etc just to see if I can actually change the selection but nothing works for me.
if (res == successMessage) {
alert(successMessage);
document.forms[0].reset();
document.getElementById("cmbList").selectedIndex = "-1";
}
What I have tried:
document.getElementById("cmbList").selectedIndex = "-1";
document.getElementById("cmbList").selectedIndex = "0";
document.getElementById("cmbList").value= "";
document.getElementById("cmbList").val()= "";