locked
Preventing Default on the WinJS Toggle Control RRS feed

  • Question

  • Is is possible to prevent the default toggle behavior of the WinJS Toggle control?

    Calling preventDefault() on the event argument of a "change" handler doesn't have any effect and the control still toggles:

    WinJS.UI.getControl(document.getElementById("myToggle")).addEventListener("change", function (e) {
        e.preventDefault();
    }, false);
    

    Monday, January 16, 2012 5:48 PM

Answers

  • Hi James,

    If you look at e.cancelable in the debugger you will see it is false.  You cannot prevent this.

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, January 18, 2012 9:16 PM
    Moderator