The code is needed for a Choose your own Adventure type of game. Of course there is going to be lots of text and buttons, so i figured that instead of writing lines of code for every button, i'd write some that uses variables.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
var n = $('button').find(this.id);
$(document).ready(function(){
$("#2").click(function(){
$("#1").hide();
$("#n").hide();
});
$("#2").click(function(){
$("#3").show();
});
});
</script>
I've tried tons of different solutions, but as I'm not that good at jQuery, i couldn't find one that worked.
I would appreciate if someone could show me whats right, and how it works. Thanks alot!
If you need more information, i'll be on tomorrow.