I have some code for a personality quiz but I'm not sure how I can increase the size of this code without dragging it on. Here is the HTML code:
<h3>1. How old are you?</h3>
<input type="radio" mess="whats up" name="q1" value="A" class="correct"/> A. 1-50.
<input type="radio" mess="You did it" name="q1" value="B" class="correct"/> B. 50-100.
<input class="button" type="submit" value="Submit" /> <input type="reset" value="Clear" />
<p class="answer"></p>
And here is the JavaScript code:
var checked;
$('.button').click(function(){
checked = $('input:checked').attr('mess');
$('.answer p').remove();
$('.answer').append("<p>"+checked+"</p>");
});
$('input[value="Clear"]').click(function(){
$('.answer p').remove();
});
I want do do that same kind of thing but for a quiz with maybe five questions and all the questions that the user answers turns into one big final answer for them and the answer is different depending on which radio buttons they choose. So is there any other way I can do that but without repeating the code for each radio button?