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 - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -