lundi 6 juin 2016

Checkbox onchange throws error

I'm placing a checkbox inside of my chartbox div.

 '<input type="checkbox" id="dbox1" onchange="calc();" checkeddata-dojo-type="dijit/form/CheckBox">'

the checkbox is displayed well, but now I want to do some actions after checkbox changed

function calc(){alert("123");}

after I clicked on the checkbox this error appears: Uncaught ReferenceError: calc is not defined

so I tested:

'<input type="checkbox" id="dbox1" onchange="alert("123");" checkeddata-dojo-type="dijit/form/CheckBox"/>'

with this code the following error occurs:

SyntaxError: Unexpected token }

Chartbox:

 new window.EvmClasses.chartBox(_domnodeId, _portletId, {
            "htmlContent" : '<input type="checkbox" id="dbox1" onchange="calc();" checkeddata-dojo-type="dijit/form/CheckBox">' +  " Minuten bis zur automatischen Aktualisierung",
            "left" : 100,
            "top" : 0,
            "width" : 410,
            "z-index" : 9,
            "height" : 25,
            "bgColorFrom" : "#ffffff",
            "bgColorTo" : "#ffffff",
            "color" : "#000000"
        });




Aucun commentaire:

Enregistrer un commentaire