JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
<body>

<p>How would you like your coffee?</p>

<form action="/action_page.php">
  <input type="radio" name="coffee" value="cream">With cream<br>
  <input type="radio" name="coffee" value="sugar">With sugar<br>
  <br>
  <input type="button" onclick="checkForm()" value="Send order">
 
</form>

JavaScript

function checkForm(){
   var checked = false;
    var choices = document.getElementsByName("coffee");;
    for (var i = 0;i < choices.length;i++){
         if (choices[i].checked) {checked = true;}
    }
    if (!checked){
        alert('Nothing, are you sure?');
    } else {
        alert('OK, here we go.');
    }
}