JSFiddle - React, Tailwind, and code Playground

by barrycorrigan

HTML

<input type="text" id="test" class="Costinput" />
<input type="checkbox" id="Enquiry_Cost_InputFree_0" />

JavaScript

$(document).on('blur change keyup', '.CostInput', function () {
  var val = $(this).val();

  if (val === "0") {
    $('input#Enquiry_Cost_InputFree_0').prop('checked', true);
  }

  if (val > 0 || val === "") {
    $('input#Enquiry_Cost_InputFree_0').prop('checked', false);
  }
});