user1234
user1234

Reputation: 27

Dojo Checkbox Label

Hi i have to create an Checkbox which is set up in JavaScript Code. For that we are using DOJO in our project. This Checkbox should just be visible for one project so i can't insert on html side. To realise the Checkbox wasn't a problem and also the visability. But i can't set a label which should be next to the Checkbox.

HTML Code:

JavaScript Code:

        if (this.createCheckInput)
        {
                this.checkInput = new CheckBox({
                    name: "checkBox",
                    id: "checkId",
                    value: "agreed",
                    innerHTML: "Publish", //Label i wan't to create
                    onChange: lang.hitch(this, function (p)
                    {
                            if (p == true) {

                            this.checkboxChecked = p;
                            }
                    })
                }, this.publishCheckbox);

        }

I Also tried it with another JavaScript Element but there is no DOJO Library I can use i just find the Textarea but the user should not be able to change the text.

JavaScript Code 2:

        //create title for checkbox
        if (this.createInputLabel)
        {
            this.showInputLabel = new Textarea ({
                value : 'Publish after upload'
            },this.publishCheckboxLabel);
        }

Thanks for helping :)

Upvotes: 0

Views: 397

Answers (1)

ben
ben

Reputation: 3568

Why not simply creating a label element ? why going so complex ?

Using dojo/dom-construct:

domConstruct('label', {innerHTML: 'Publish after upload'}, this.publishCheckboxLabel);

Upvotes: 2

Related Questions