I'm working on a website, and i have a part which consist in hide/show elements when the user's clicking on a menu.
Here is the issue :
$('[id^="answer"]').hide();
$('[class^="test"]').on('click', function(e){
e.preventDefault();
var numb = this.className.replace('test', '');
$('[id^="answer"]').hide();
$('#answer' + numb).show();
});
$(document).ready(function(){
$('a').click(function(){
$('a').removeClass("active");
$(this).addClass("active");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a class="test3" href="#">> test</a>
<div id="answer3">
<div class="center">
<p>hello</p>
</div>
</div>
</div>