javascript - Jquerymobile: label text is not changing with slider value -


hi in jquery mobile app trying change label text on moving jqm slider , in jsfiddle working fine , when try run on browser nothing working. below code:

<label for="slider">choose:</label>     <input type="range" name="slider" id="slider" value="0" min="0" max="5"  />      <label id="sliderlabel">strongly agree</label> 

below script

<script type="text/javascript">      $("#slider").change(function() {     sval = $(this).val();      if(sval ==1 ) {          $('#sliderlabel').text('neither agree nor disagree');     }    }); </script> 

not sure wrong doing. appreciated.

try use:

$(document).on('pagecreate', function() {     $("#slider").change(function () {         sval = $(this).val();          if (sval == 1) {              $('#sliderlabel').text('neither agree nor disagree');         }     }); }); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -