Modifying Sliders

R_IR_I Community Member Qubie ✭

Modifying Sliders

I am trying to add "%" to a slider so that when someone slides through, the user reads a number along with the "%" sign, for e.g. instead of "7", the user sees "7%" on top of the slider. Is there a way to implement this through JS? Thanks.

Tagged:

Best Answer

  • [Deleted User][Deleted User] Qubie ✭
    Accepted Answer

    Hello @R_I ,

    Paste the below code in the js(OnReady) of the slider question

      jQuery("#"+this.questionId+" div.track").mousedown(function (e1) {
      jQuery(document).mouseup( function(e2) {
            var s = jQuery(".sliderToolTipBox ").text().replace("%","");
             jQuery(".sliderToolTipBox ").text(s+"%");    
      });
    });
    

Answers

  • TomGTomG Raleigh, NCCommunity Member Wizard ✭✭✭✭✭

    Yes, the best way to do this is with a Mutation Observer.

  • R_IR_I Community Member Qubie ✭

    @TomG said:
    Yes, the best way to do this is with a Mutation Observer.

    I am a beginner at JS and I do not know about this command. How can I implement it? Thanks.

  • PavanPavan NetherlandsCommunity Member Qubie ✭

    @TomG I am also looking for a solution. Do you have a sample code? Could you please share here in this forum

Sign In to Comment