I have let's say sets of div:
<body>
<div id="div1" style="display: block">
<p> paragraph here </p>``
<img>
<table></table>
</div>
<div id="div2" style="display: none">
<p> paragraph here </p>
<img>
<table></table>
</div>
I surrounded each contents with div.
Now I have two radio buttons:
<label for="button1"> Button1 </label>
<input id="button1" name="button" type="radio" value="block">
<label for="button2"> Button2</label>
<input id="button2" name="button" type="radio" value="block">
Now what I want to do is to hide the current div and display the second div in place of the first div using .css(). The method I have now is:
$('#button1').on('change', function1);
function function1() {
let change1 = $('#button1').val();
$('#div1').css('display', change1);
but here, when I tried the second button:
$('#button2').on('change',function2);
function function2() {
let change2 = $('#button2').val();
$('#div2').css('display', change2);
$('#div1').css('display', 'none');
but it doesn't work, it can only execute one or the other but not both of them. Anyone knows the problem? Thank you.