How to set default value for jQuery UI Slider

Yesterday while for one of my requirement, I need to set default value of the jQuery UI slider. That means when page is loaded there should be a default value for slider. For example, if the range allowed for slider is 0 to 100 and when page loads slider should have 18 as default value.

The jQuery UI slider has option named "value", which can be used to set the value of the slider.
//Code Starts
​$(document).ready(function()
{  
   var iValue = 18;
   $("#lbl").text(iValue); 
   $("#slider").slider(
   {
     min:0,
     max:100,
     value:iValue,
     slide:function(event,ui) 
     {
       $("#lbl").text(ui.value);
     }
  });
});​
//Code Ends
See result below.



Feel free to contact me for any help related to jQuery, I will gladly help you.
SHARE

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..