How to read ToggleSwitch value in WinJS -


i want read if 1 value selected or (1 or 0, true or false) in winjs using toggleswitch:

code html:

<div id="toggleswitchdocformat"  class="toggleswitchdocformat" data-win-control="winjs.ui.toggleswitch" data-win-options="{labelon:'guardar documento como: tiff', labeloff:'guardar documento como: pdf', checked:true}"></div> 

code javascript:

app.onloaded = function () {         getdomelements();          toggleswitchdocformat = document.getelementbyid("toggleswitchdocformat").wincontrol;         console.log("the value of toggleswitch: " + toggleswitchdocformat.checked);      } 

message:

el código de biblioteca de javascript está punto de detectar la excepción. en línea 119, columna 9 en ms-appx://.../js/default.js

0x800a138f - error en tiempo de ejecución de javascript: no se puede obtener la propiedad 'tostring' de referencia nula o sin definir

si hay un controlador para esta excepción, el programa puede continuar de forma segura.

when hover toggleswitch code found "undefined" value, doing wrong??

without console.log line toggleswitch shown on screen, want it's value, i'll appreciate

try code:

args.setpromise(winjs.ui.processall().then(function () {                  document.getelementbyid("toggleswitchdocformat").wincontrol.addeventlistener("change", function switchchanged(e) {                     var _toggleswitchdocformat = e.target.wincontrol;                     console.log("is active??: " + _toggleswitchdocformat.checked);                 });             })); 

Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -