Search code examples
dojo

use Dojo to style a programmatically generated combo box


I want to set the text size for a programmatically generated combo box using dojo codes below. The width and height work but not the font-size.

var cboState = new ComboBox({
                             id: "usastate",
                             name: "usastate",
                             style:{width: "100%", height: "40px", fontsize: "20px"},
                             placeholder: "Select a State",
                             store: stateStore,
                             searchAttr: "name",
                             autocomplete: true
});


Solution

  • Change fontsize to fontSize and it will work.

    var cboState = new ComboBox({
                              id: "usastate",
                              name: "usastate",
                              style:{width: "100%", height: "40px", fontSize: "20px"},
                              placeholder: "Select a State",
                              store: stateStore,
                              searchAttr: "name",
                              autocomplete: true
    });
    

    Or, you can also pass the style as a string:

    var cboState = new ComboBox({
                              id: "usastate",
                              name: "usastate",
                              style:"width: '100%'; height: '40px'; font-size: '20px'",
                              placeholder: "Select a State",
                              store: stateStore,
                              searchAttr: "name",
                              autocomplete: true
    });