This is my code where onclick function is mentioned. This code works fine on firefox but it doesnt work on chrome. the onclick function is working on firefox i.e when i click on degree it displays the checkbox but when i run this same code on chrome it is not displaying the checkboxes.
function myFunction() {
var x = document.getElementById("mydiv");
var y = document.getElementById("mydiv1");
if (x.style.display === "none") {
x.style.display = "block";
y.style.display = "none";
} else {
x.style.display = "none";
}
}
function myFunction1() {
var x = document.getElementById("mydiv1");
var y = document.getElementById("mydiv");
if (x.style.display === "none") {
x.style.display = "block";
y.style.display = "none";
} else {
x.style.display = "none";
}
}
<select>
<option value="Degree" onclick="myFunction()">Degree</option>
<option value="Diploma" onclick="myFunction1()">Diploma</option>
</select>
<div id="mydiv" style="display:none;">
<div>
<label class="switch">
<input type="checkbox" name="subject[]" value="Subject-1" id="myCheck" onclick="Function()">
<span class="slider"></span>
</label> Subject-1
</div>
</div>
<div id="mydiv1" style="display:none;">
<div>
<label class="switch">
<input type="checkbox" name="subject[]" value="Subject-1" id="myCheck" onclick="Function1()">
<span class="slider"></span>
</label> Subject-1
</div>
</div>
Any suggestions? How can this code work on chrome?