I have a selector that allows me to choose between three types of laptop. However when choosing a brand of laptop, 3 types of that brand must appear as radio buttons. I'm trying to make a javascript fade in/out. So that if i select toshiba, the types of toshiba fade in, and if i select another brand, the current brand displayed fade out and the other fade in. I tried a js fade in/out functionality but i'm not sure how to alter it to fade in/out several elements. Any help please?
<!DOCTYPE HTML>
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="custom.css">
</HEAD>
<body>
<div id="laptop">
<form>
<select>
<option id="handle" value="toshibalap" selected>toshiba</option>
<option id="handle" value="acerlap">acer</option>
<option id="handle" value="hplap">hp</option>
</select>
<div id="slideSource">
<strong>toshiba 1<input type="radio" name="toshiba1" value="toshiba1" checked></strong>
<strong>toshiba 2<input type="radio" name="toshiba2" value="toshiba2"></strong>
<strong>toshiba 3<input type="radio" name="toshiba3" value="toshiba3"></strong>
</div>
<div id="acer">
<strong>acer 1<input type="radio" name="acer1" value="acer1" checked></strong>
<strong>acer 2<input type="radio" name="acer2" value="acer2"></strong>
<strong>acer 3<input type="radio" name="acer3" value="acer3"></strong>
</div>
<div id="hp">
<strong>hp 1<input type="radio" name="hp1" value="hp1" checked></strong>
<strong>hp 2<input type="radio" name="hp2" value="hp2"></strong>
<strong>hp 3<input type="radio" name="hp3" value="hp3"></strong>
</div>
</form>
</div>
<script>
var slideSource = document.getElementById('slideSource');
document.getElementById('handle').onclick = function(){
slideSource.className = slideSource.className ? '' : 'fade';
}
</script>
</body>
</HTML>
CSS:
div#slideSource {
opacity:1;
transition: opacity 1s;
}
div#slideSource.fade {
opacity:0;
}