Copy link to clipboard
Copied
I am attempting to use an Animate HTML5 canvas document with radio buttons and checkboxes.
I would like some of the checkboxes to be initially displayed as checked.
I drag a checkbox component to the canvas, give it a name (chkBox1) and open the component parameters: There are label, value, disabled, visible and class properties.
The question is how to set the initial value of the checkbox to be checked.
There is a similar question can be asked relative to radio buttons as I would like a default selection identified when first displayed.
Hi tmkeeley
The components you add to your HTML5 documents do not become part of the canvas, they become part of the surrounding HTML structure (DOM), particularly the division "dom_overlay_container".
in order to manipulate e.g. the checkbox component you have to use HTML DOM Javascript. In the frame where you dragged a checkbox component to the canvas and named it "chkBox1", add into your code layer the following:
...setTimeout(function () {
document.getElementById("chkBox1").checked = true;
}, 0)
Copy link to clipboard
Copied
Hi tmkeeley
The components you add to your HTML5 documents do not become part of the canvas, they become part of the surrounding HTML structure (DOM), particularly the division "dom_overlay_container".
in order to manipulate e.g. the checkbox component you have to use HTML DOM Javascript. In the frame where you dragged a checkbox component to the canvas and named it "chkBox1", add into your code layer the following:
setTimeout(function () {
document.getElementById("chkBox1").checked = true;
}, 0);
The same property checked is valid too for your radio buttons.
Find more infos here:
Checkbox HTML DOM Input Checkbox Object
Radi button HTML DOM Input Radio Object
Klaus
Copy link to clipboard
Copied
Instead of a timeout function you can use the JQuery document ready function to initally set a value or whatever.
$(document).ready(function () {
$("#r1").attr('checked', 'checked');
});
All the ui- Elements are JQuery Elements so if you need a documentation, you should look vor JQuery Components
Copy link to clipboard
Copied
Instead of a timeout function you can use the JQuery document ready function to initally set a value or whatever.
$(document).ready(function () {
$("#r1").attr('checked', 'checked');
});
All the ui- Elements are JQuery Elements so if you need a documentation, you should look vor JQuery UI Components.