2

I'm trying to access the value that a user chooses by manipulating the jQuery Mobile slider. For example, I have a slider that ranges from 1 to 10. The user moves the slider to 5. How can I send that '5' to a controller?

I've read through about 10 separate examples, and they all gloss over how to actually access the data from the slider.

Is a params hash created? Do I need to put the slider within a form_for Rails element? Any examples of actually using the value from a jQuery Mobile slider?

Thanks

4

2 回答 2

1

http://jsfiddle.net/99AfX/

$('#btn').live('click',function(){
      alert($('#slider-0').val());
});
于 2012-05-25T01:36:14.373 回答
0
$('#your_slider_id').change(function(){console.log(this.value)});
于 2012-05-25T10:30:42.303 回答