JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="Quantity" />
<input type="hidden" id="StockLvl" value="2" />
<div id="Result"></div>
JavaScript
$("#Quantity").live("focusout", function() {
var qty = $(this).val();
var stock = $('#StockLvl').val();
if (qty > stock) {
$('#Result').html("<p>Quantity: " + qty + "</p><p>Stock: " + stock + "</p>" + "<p>Not Enough Stock.</p>");
}
else if (stock > qty || stock == qty) {
$('#Result').html("<p>Quantity: " + qty + "</p><p>Stock: " + stock + "</p>" + "<p>Enough Stock.</p>");
}
});