JavaScript Toolbar

Invoke the addTool method of the jqxToolBar. Author: http://jqwidgets.com

by jqwidgets

HTML

<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<div id="jqxToolBar"></div>
<div>
    <input style="margin-top: 150px;" type="button" id="jqxButton" value="Add a new tool" />
</div>

JavaScript

$("#jqxToolBar").jqxToolBar({
    theme: "energyblue",
    width: "100%",
    height: 50,
    tools: "button | dropdownlist combobox | input",
    initTools: function (type, index, tool, menuToolIninitialization) {
        switch (index) {
            case 0:
                tool.text("Button");
                break;
            case 1:
                tool.jqxDropDownList({
                    width: 130,
                    source: ["Affogato", "Breve", "Café Crema"],
                    selectedIndex: 1
                });
                break;
            case 2:
                tool.jqxComboBox({
                    width: 50,
                    source: [8, 9, 10, 11, 12, 14, 16, 18, 20],
                    selectedIndex: 3
                });
                break;
            case 3:
                tool.jqxInput({
                    width: 200,
                    placeHolder: "Type here..."
                });
                break;
        }
    }
});

$("#jqxButton").jqxButton({
    theme: "energyblue",
    height: "30px",
    width: "120px"
});

$("#jqxButton").on("click", function () {
    $("#jqxToolBar").jqxToolBar("addTool", "button", "last", true, function (type, tool, menuToolIninitialization) {
        var width = 100;
        if (menuToolIninitialization === true) {
            width = "100%";
        }
        tool.text("New button");
        tool.jqxButton({
            width: width
        });
    });
});