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 () {
  if ($(this).val() == 0) {
    $('input#Enquiry_Cost_InputFree_0').prop('checked', true);
  }

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