I need to fade out row when a specific select value is selected (let's say "termination"). Fade in, when any other is selected. Code works fine with div ID outside the table, but when div is encapsulated with tr & td (put into table), it stops to work. I tried my luck with tbody ID, but no luck. Please help me with pure javascript. My brain somehow does not like jQuery. But I think the function for fading is fine, I just need to make it work with a row in the table.
Here is my code:
<table>
<tr>
<td>Select Type:</td>
<td>
<select
name="vipselect"
id="vipselect"
onchange="fade('vipselect','agencyrow')"
>
<option value="0" selected value="0" selected style="display: none">
Please Select
</option>
<option value="fastL4">ltm virtual V10.112.x.x_any (Fast L4)</option>
<option value="passthrough">ltm virtual Vx.x.x.x_443 (Standard)</option>
<option value="termination">
ltm virtual Vx.83.x.x_443 (Standard)
</option>
</select>
</td>
</tr>
<tr>
<td>test:</td>
<td><input id="other" name="other" type="othertext" /></td>
</tr>
<tbody id="agencyrow" style="display: none">
<tr>
<td>test:</td>
<td><input id="sslcert" name="sslcert" type="text" /></td>
//this row to fade/unfade
</tr>
</tbody>
</table>
javascript:
function f_fade(parent, elm) {
var x = document.getElementById("vipselect");
if (x.options[x.selectedIndex].value == "termination") {
document.getElementById(elm).style.display = "block";
f_fade_in(0, elm);
} else {
f_fade_out(100, elm);
}
}
function f_fade_out(para, elm) {
document.getElementById(elm).style.opacity = para / 100;
var t1 = setTimeout(function () {
if (para > 0) {
f_fade_out(para - 1, elm);
} else {
document.getElementById(elm).style.display = "none";
}
}, 1);
}
function f_fade_in(para, elm) {
document.getElementById(elm).style.opacity = para / 100;
var t1 = setTimeout(function () {
if (para < 100) f_fade_in(para + 1, elm);
}, 1);
}