Page 1 of 1

toggeling button state on event

Posted: Fri Jul 13, 2012 1:01 am
by adi

i have a toggle button in my screen,
i would like to change his state according to local storage variable value.

i have this code to do the job but i don't know:

  1. on which event should this code fire i.e. on screen load? on screen show?

  2. how do i refresh the screen by code so that the button new state is shown?

    what i always see is its default state which is On.

    if(toggle_button.match(/on/i))
    {

    var input = Tiggr(toggle_button);
    input.val('on');
    alert (input.val());
    }
    else
    {
    var input = Tiggr(toggle_button);
    input.val('off');
    alert (input.val());
    }


toggeling button state on event

Posted: Fri Jul 13, 2012 1:25 am
by adi

found it...it's not trivial to look for but its soooo simple once you get it
http://jquerymobile.com/demos/1.1.0-r...