I want to use a very small piece of Java-script to show or not to Show one field with options depending on if one or the other checkbox is checked. It works on every browser, but not in the IE-Browsers lower than Edge. Can this be a problem with the ".checked"-method" or do I have to use another Syntax in older IEs for the "if-else-loop?"
Thank you, for the quick answers! to be more exact: I don't need to develop for IE<9. When I use ".getElementsByClassName" outside the if-statement the code works on IE9 to 11. The Problem must be something with the else-if or with the .checked-method. I tried some other syntax-variants, but I didn`t get it to work. Some Ideas for a correct syntax like ".checked == true" or so?
function oneortwo() {
if(document.getElementById("opt_18_0").checked) {
document.getElementsByClassName("fieldset_file2")[0].style.display = "none";
} else {
document.getElementsByClassName("fieldset_file2")[0].style.display = "block";
}
}
opt_18_0.onclick=oneortwo;
opt_18_1.onclick=oneortwo;