I have three distinct dropdown boxes, each one contain a list that is common to that three boxes. My need is to filter the list like,
when user selects an option in the first dropdown, then he goes to next, he shouldn't get the option in the list the is selected earlier in the first dropdown.
This is the image showing two dropdowns, I need three of them.
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function cleanMonth(ddl) {
var val = ddl.options[ddl.selectedIndex].value;
//Clear all items
$("#ddlMonth2 > option").remove();
//Add all options from dropdown 1
$("#" + ddl.id + "> option").each(function () {
var opt = document.createElement("option");
opt.text = this.text;
opt.value = this.value;
document.getElementById("ddlMonth2").options.add(opt);
});
//Remove selected
$("#ddlMonth2 option[value='" + val + "']").remove();
}
</script>