Handlebars checkbox helper

jQuery -- Posted on May 15, 2022

Handlebars checkbox helper

              
                Handlebars.registerHelper("makeCheckBox", function(name, label, value){
        let output = '<div class="form-check">';
        output += '<input class="form-check-input" name="'+ name + '"' +'type="checkbox" value="' + value + '"'
        console.info(typeof(value), value);
        if(value === true){
             output += 'checked ';
        }
        output +='id="' + name + 'Default"' + '>';
        output +='<label class="form-check-label" for="' + name + 'Default">' +
                    label + '</label></div>';
        return output;
    });
                  
   
            

Related Posts