I have a similar problem like old problem of mine.
my code:
function reset_admin()
{
a = document.getElementById('event').value;
t = document.getElementById('category').value;
document.getElementById('admin').reset();
document.getElementById('event').value = a;
document.getElementById('category').value = t;
}
<form id="admin" action="iframe_admin.php" onsubmit="" method="post" target="iframe_admin">
.....
<input type="button" class="filter_button" id="Clear" name="Clear" value="Clear"
onclick="reset_admin();document.getElementById('admin').submit(); />
the function is in external js file.
the propose is that after pressing on clear, the event and the category will stay the same before the clear.
In ff it’s works. In IE the event and the category are empty and than the page get stacked.
I tried to do:
function reset_admin()
{
a = document.getElementById('event').options[getElementById('event').selectedIndex].value;
t = document.getElementById('category').options[getElementById('category').selectedIndex].value;
document.getElementById('admin').reset();
document.getElementById('event').value = a;
document.getElementById('category').value = t;
}
but this is not working as well.
thank you!
Store and restore the
selectedIndexinstead since you don’t care about the actual value, like this:I also added
varto the indexes your fetching, just to about the global variables there, but that’s not the important change, settingselectedIndexinstead is 🙂You can give it a try here.