teaman
teaman

Reputation: 479

Why does the label for the dijit.form.radiobutton not show up?

I have this code but the label does not show up:

            var radioOne = new RadioButton({
                label: "Current",
                style: "margin-left:10px",
                checked: true
            }).placeAt(userDiv);

Do I have to do a domCreate of an actual label tag?

Upvotes: 0

Views: 1886

Answers (2)

teaman
teaman

Reputation: 479

I've gone ahead and am using this to create the label tag.

            var label = domConstruct.create("label", {
                for: "Previous",
                style: "margin-left:5px",
                innerHTML: "Previous"
            }, userDiv);

this does work but seems this should be included in the RadioButton widget.

Upvotes: 2

Math is Hard
Math is Hard

Reputation: 942

Yes you do. This was from the dojo documentations:

Script:

var radioOne = new RadioButton({
            checked: true,
            value: "tea",
            name: "drink",
        }, "radioOne");

HTML:

<input type="radio" name="drink" id="radioOne" checked value="tea"/> <label for="radioOne">Tea</label>

Upvotes: 1

Related Questions