I have this function where if the textbox has a value of 0 the checkbox will be set to true. But I have this weird scenario where if the textbox is blank or greater than 0 I need the checkbox to be false
When I debug true this seems to be "" and 0 are the same thing Does anyone know how I would go about making this work?
$(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);
}
});
And I have created a JS fiddle = https://jsfiddle.net/barrycorrigan/Lqxuvr4w/9/