JSFiddle - React, Tailwind, and code Playground

by Akram kamal

HTML

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<form id="form1" method="post" action="javascript:alert('form submitted')">
      <p>&bull; Which version would you like to run?<br/>
        <input id="variables" type="radio" name="version" value="variables" />
        <label for="variables">Individual Variables</label><br/>
        <input id="array" type="radio" name="version" value="array" />
        <label for="array">Array Representation</label>
      </p>
      <p>&bull; Would you like to find the largest, or smallest number?<br/>
        <input id="large" type="radio" name="type" value="large" />
        <label for="large">Largest</label><br/>
        <input id="small" type="radio" name="type" value="small" />
        <label for="small">Smallest</label>
      </p>
      <p>&bull; Use random numbers, or input your own?<br/>

        <input id="random" type="radio" name="numSelect" value="random" />
        <label for="random">Generate random numbers for me</label><br/>
        <input type="text" name="nums" id="nums" value="How many? (2 to 10)" disabled="disabled"/><br/><br/>

        <input id="userDef" type="radio" name="numSelect" value="userDef"/>
        <label for="userDef">I want to use my own numbers</label><br/>
        <input id="userNums" type="text" name="userNums" disabled="disabled"/><br/><br/>

        <input type="submit" name="submit" value="Start the Simulation!" />
      </p> 
    </form>

JavaScript

$(function(){

  $('#form1').validate({
    rules:{
      version: "required",
      type: "required",
      numSelect: "required",
      userNums: "required"
    }
  });
});