Ken
Ken

Reputation: 207

Add plus sign "+" for positive values with jQuery ui-slider?

Is there a way to add plus sign "+" for positive values with jQuery ui-slider? By default the negative sign shows but I want the positive sign as well to show the difference from starting value.

Upvotes: 0

Views: 632

Answers (1)

Runcorn
Runcorn

Reputation: 5224

I reckon you have already figured out the solution for it. If not here is the answer.

You can use the slide and create events for manipulating these values in Slider ,

    create : function() {
           //For initialization event 
           var value=$(".slider").slider( "value" );
           $("#amount").val((value > '0') ? ('+'+ value) : value);
    },
    slide: function (event, ui) {
           //Slide Event
           $("#amount").val((ui.value > '0') ? ('+'+ ui.value) : ui.value);
    }

Here is the working fiddle

Upvotes: 1

Related Questions