I have a dashboard where I have multiple drop down values, one of the drop-down have values which when get selected and a submit button is clicked it replaces the existing page
<script type="text/javascript">
function showlevel1() {
var l1 = document.getElementById('level1_category');
l1.style.display = 'block';
var l2 = document.getElementById('level2_category');
l2.style.display = 'none';
}
function showlevel2() {
var l2 = document.getElementById('level2_category');
l2.style.display = 'block';
var l1 = document.getElementById('level1_category');
l1.style.display = 'none';
}
function categorySelectHandler(select) {
if (select.value == '1') {
var l1 = document.getElementById('level1_category');
l1.style.display = 'none';
var l2 = document.getElementById('level2_category');
l2.style.display = 'none';
} else if (select.value == '2') {
showlevel1();
} else if (select.value == '3') {
showlevel2();
}
}
</script>
<html>
<select id="select_level" onchange="categorySelectHandler(this)">
<option value="1">Create at level 1</option>
<option value="2">Create at level 2</option>
<option value="3">Create at level 3</option>
</select>
<div id="level1_category" style="display:none;">
// # Your Code Here
</div>
<div id="level2_category" style="display:none;">
// # Your Code Here
</div>
</html>