help with jquery slider range option

Is there a way to limit the slider options in jQuery UI slider?

I have a slider that is broken up into 5 parts.

However, I only want options 2,3, and 4 available. I don't want the handle to go to 1 or 5.

how do you restrict this?



You can listen to the slide event and test for it's position.

When it's at 1 or 5, you can return false and cancel the event.

This seems to work

$( ".selector" ).slider({
    min: 1,
    max: 5,
    value: 2,
    slide: function(event, ui) {
       if(ui.value == 1 || ui.value == 5)
           return false;

Have a play here.

Need Your Help

reading from input tag outside form element

php javascript html forms input

I have a web page with an input field (a calendar to select a date from).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.