Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

value not available in create event on jQuery UI slider?

$('#foo').slider({
  range: 'min',
  min: 0,
  max: 1000,
  step: 100,
  value: 500,
  create: function( event, ui) {
          var bar = ui.value;
  },
  //etc...
});

Why is bar undefined and not 500? Is it possible to assign a variable to the value in the create event?

like image 746
jaacob Avatar asked Apr 30 '12 18:04

jaacob


1 Answers

You can also use

create: function( e, ui ) {
    var bar=$(this).slider('value');
}

DEMO.

like image 142
The Alpha Avatar answered Sep 28 '22 01:09

The Alpha