Setting Jquery UI slider's initial value from an input -


i'm trying generalize slider code work few input + slider combinations.

i have working - slide slider, input value updates or enter number in input, slider moves proper location.

however, i'm having trouble initializing sliders default values of inputs. here's code looks like:

javascript

$(".slider").slider({         min: 0,         max: 5,         value: $(this).parent().find(".inputnumber").val(),         step: 0.25,         slide: function (event, ui) {             $(this).parent().find(".inputnumber").val(ui.value);         }     }); 

html

    <div class="inputwrap hidden">     <input class="mini inputnumber" type="text" value="0.5">     <div class="slider"></div>     </div> 

this works me (with number of sliders):

$(".slider").slider({     min: 0,     max: 5,     step: 0.25,     slide: function (event, ui) {         $(this).parent().find(".inputnumber").val(ui.value);     },     create: function(event, ui){         $(this).slider('value',$(this).parent().find(".inputnumber").val());     } }); 

demo: http://jsfiddle.net/darkajax/uv5ac/


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -