JSFiddle - React, Tailwind, and code Playground

by ChrisStanyon

HTML

<input name="showall" type="checkbox" id="showall" value="Y">

JavaScript

var changeEvent = function() {
    if ($('#showall').is(':checked')) {
        var showAllValue = 'Y';
        var brandValue = '';
    } else {
        var showAllValue = 'N';
        var brandValue = 'something Else';
    }

    console.log(showAllValue);
    console.log(brandValue)
}    

changeEvent();
$("#showall").on( "change", changeEvent);