html5 - Using flip toggle switch i my not getting alert message when toogle is "off" or "on" -


using flip toggle switch not getting alert message when toogle "off" or "on" in jquery mobile plz me out

in html5

<select name="toggleswitch1" id="toggleswitch1" data-theme="" data-role="slider">   <option value="off">off</option>   <option value="on">on</option> </select> 

in script

 $(document).bind("pageinit", function () {        $("#toggleswitch1").unbind('change').bind('change', function() {      if ($("#toggleswitch1").val('off').slider('refresh')) {        alert("off");      }      else {        alert("on");      }   }); });    

working example: http://jsfiddle.net/39dek/

$(document).on('pageinit', '#index', function(){      $(document).off('slidestop',"#toggleswitch1").on('slidestop', "#toggleswitch1" ,function() {               if ($("#toggleswitch1 option:selected").val() == 'off')  {             alert("off");         } else {             alert("on");         }     }); }); 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -