JSFiddle - React, Tailwind, and code Playground
HTML
Text1:<input type="text" id="text1" /><br />
Text2:<input type="text" id="text2" />
JavaScript
var text2 = document.getElementById('text2');
text2.onchange = function(){
x = Number(document.getElementById('text1').value);
y = Number(this.value);
if(x < y)
{
alert('Invalid');
}
}