0

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.

Ken
  • 207
  • 1
  • 11

1 Answers1

1

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

Runcorn
  • 5,144
  • 5
  • 34
  • 52
  • Thanks for answering! This is a huge help. I did end up finding a solution but Stackoverflow deemed my answer 'trivial' and turned it into a comment (see @Ken above). I am using it to determine the difference of change instead of long a scale - useful because the orig. value tends to get lost when it is adjusted. Thanks again for your time. I didn't even think of using the 'create' event. K. – Ken Jan 30 '15 at 17:26