JSFiddle - React, Tailwind, and code Playground

by bingjie2680

HTML

<form> 
<label>Date of Birth</label>
     <input type="textbox" id="dd1" />
     <input type="textbox" id="mm1" /> 
     <input type="textbox" id="yy1" />
     <label>Confirm Date of Birth</label>
     <input type="textbox" id="dd2" />
     <input type="textbox" id="mm2" /> 
<input type="textbox" id="yy2" />
</form>

JavaScript

$(document).click(function(){
if(['dd','mm','yy'].every(
     function(field){
            return document.getElementById(field+1).value 
                   === document.getElementById(field+2).value
     })
)
    alert('the same');
})