Add incremental value to an id of the body tag

Hi all,

I’ve got a series of questions and im after having that every time the next button is clicked, the value to that is added to the body tag as an id, so that i can use this as a hook to let the user know what question they are on.

<body id="question_[incrementaing value]">

<a value="0">Next Question</a>

Here is what i’ve got so far that gets the value and the adds 1 to it every time it is clicked…

<script type="text/javascript">
var i = 0;
function Next_Question() {
    var NextQ = document.getElementById("Next");
	 document.getElementById('Next').value = ++i;
	console.log(i+"_next");
	
}
</script>

In that code i after adding that value to the existing id of the body tag.

any pointers would be great…

Thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.