I am struggling with my code which has unnecessary information.
<div>
<div id="one" class="button"></div>
<div id="two" class="button"></div>
</div>
<div>
<div class="Home tab">
<h1> Greetings! </h1>
<p> Welcome to my fantastic page! </p>
</div>
<div class="other tab">
<h1> Artistic Expressions </h1>
<p> Have a look at this amazing content! </p>
</div>
</div>
<script>
$( "div.button" ).click(function() {
$( "div.Home" ).toggleClass( "Show" );
$( "div.Home" ).toggleClass( "tab" );
});
</script>
<style>
.tab
{
display: none;
}
.Show
{
display: block;
}
</style>
My main issue lies within this code as I aim to click on button one and set the home, then proceed to click on button two and switch to other tabs. Unfortunately, my attempts to accomplish this have been unsuccessful due to my limited knowledge of JavaScript. Even trying both buttons to set home did not yield any results.
I am in dire need of assistance. Your help would be greatly appreciated.