I'm trying to add button to refresh the Quiz after answering the questions incorrectly but when I click reload it reloads the whole page instead, I'm using the function below, really appreciate any help. thanks
$(function() {
$("#myButton").click(function() {
window.location.reload();
});
});
It sounds like you want to reset the form instead of refreshing the page. window.location.reload(); is basically hitting CTRL+R.
Consider just resetting the form tag.
document.getElementById('myform').reset();
Keep in mind, however, that you'll still have to reset any values located elsewhere (like the js files) that were based on user input.
If you want to retain the results of the quiz and visit another webpage, then you'll need to use AJAX and store the values in a backend somewhere.