I cannot get this to work.
I have 2 buttons. I also have divs. When I click 1 button, I want 1 div to show and for the other to be hidden. When I click the other button, I want the opposite to happen. They should both be hidden on default.
Javascript function:
$(document).ready(function() {
$("#button-one").click(function() {
$("#div-one").hide();
$("#div-two").show();
});
});
$(document).ready(function() {
$("#button-two").click(function() {
$("#div-one").show();
$("#div-two").hide();
});
});
I have also tried $('#sdfsdfs').css('display', 'block'), and document.getElementById("fsdfsdf").style.display="block";
HTML extract:
<div class="buttonOne">
<button id="button-one" value="button one"> Button One </button>
</div>
<div class="buttonTwo">
<button id="button-two" value="button two"> Button Two </button>
</div>
<div class="divOne" id="div-one" style="display: none;">
Some HTML
</div>
<div class="divTwo" id="div-two" style="display: none;">
Some HTML
</div>
</div>
</div>
Code above is how it goes, ignore the names.
What happens is when I load the page, each div is set to display: none, which is fine, however the clicks do not change the display to show. I am editing the values of a rich text component in AEM as well if that changes anything.
I have 2 buttons. I also have divs. When I click 1 button, I want 1 div to show and for the other to be hidden. When I click the other button, I want the opposite to happen. They should both be hidden on default.
Code all is put above. Tried a lot of different ways of editing display, as well as setting the ID on css itself to display: none and editing on javascript.