slider events

slider events

Hi,

I am using jqm 1.4.4 in a multi-page website and I would like to catch the state of a slider when a user swiped or taped the slider.

I'm trying to do it like this :

  1. <div class="ui-field-contain">
  2.   <label for="slider-'+key+'">flip-'+key+'</label>
  3.   <select name="flip-'+key+'" id="flip-'+key+'" data-identity="'+key+'" data-role="slider">
  4.     <option value="off">Off</option>
  5.     <option value="on" selected>On</option>
  6.   </select>
  7. </div>'
  8.                                    
  9. $("#flip-"+key).bind('change', function(e) {
  10. //$(« #flip-"+key).change(function() {
  11.   e.preventDefault();
  12.   e.stopImmediatePropagation();
  13.   console.log('fired ! ='+$(this).val() + ' or '+$("#flip-"+key).val());
  14. });

Of course it doesn't work.

BTW, the slider code is not present onload. I create it on the fly. This is a problem in my implementation because everytime you go back to the same page, the same piece of code (line9 - line14) will be created again...
Anyway, it doesn't work.

Can anyone tell me what's wrong and how to do this ?

I really like the online demo. But only one thing is missing : the javascript code for those kind of elements...
Where can I find the online manual with this part of the code ?


Cheers