JSFiddle - React, Tailwind, and code Playground

HTML

<input type="radio" name="choice" value="1"/> 1
<input type="radio" name="choice" value="2"/> 2
<input type="radio" name="choice" value="3"/> 3
<input type="button" onclick="checkAnswer(1,1,0)" value="Check" />
<div id="databox">
</div>

JavaScript

var last = 1;
var databox = $('#databox').get(0);
function checkAnswer(result,id, corrected)
   {
    var value;
      var choice=document.getElementsByName('choice');
      for(var i=0;i<choice.length;i++)                               //checkAnswer() function e problem ache 
      {
        if(choice[i].checked)
        {
           value=choice[i].value;
        }
      }
        if(value==result)
        {
          corrected++;
        }
        if(id==last)
      {
        databox.innerHTML='<h3> You have given '+corrected+' correct answers out of '+last;
      }

   }