Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7053941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:33:57+00:00 2026-05-28T03:33:57+00:00

This is a bit like the problem posted here: Yes or no toggle or

  • 0

This is a bit like the problem posted here: Yes or no toggle or slider – but i can’t get the solution to work in this example.

I have a horizontal incremental range slider which i would like to modify so that the labels are decoded to small – medium – large for values 1 – 2 – 3

I’ve tried sticking an array to decode but i just can’t get it to work right.

Here’s what i have so far:

    <script>
        $(function() {
            $( "#slider-range" ).slider({
                range: true,
                min: 1,
                max: 3,
                step: 1,
                values: [ 2, 3 ],
                slide: function( event, ui ) {
                    $( "#amount" ).val( ui.values[ 0 ] + " - " + ui.values[ 1 ] );
                }
            });
            $( "#amount" ).val( $( "#slider-range" ).slider( "values", 0 ) +
                " - " + $( "#slider-range" ).slider( "values", 1 ) );
        });
    </script>

so that if positions 2 – 3 were selected (as is the default), the label would read ‘medium – large’.

Any help or direction would be much appreciated!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:33:58+00:00Added an answer on May 28, 2026 at 3:33 am

    What about this?

    It uses a mapper object instead of an array but also includes a function that returns a string instead of creating it yourself:

    $(function() {
    
        // mapper    
        var valueMap = {
            1 : "small",
            2 : "medium",
            3 : "large",
            getText : function(arr) {
                return this[arr[0]] + " - " + this[arr[1]];
            }
        };
    
        // initial range slider values
        var initial = [2, 3];
    
        // initialize slider
        $( "#slider-range" ).slider({
            range: true,
            min: 1,
            max: 3,
            step: 1,
            values: initial,
            slide: function( event, ui ) {
                $("#amount").val(valueMap.getText(ui.values));
            }
        });
    
        // initialize value display
        $("#amount").val(valueMap.getText(initial));
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a noob question that I will get slated for but here
I posted this once, but I was a bit too vague in my information,
I have posted a question on here previously asking similar advise, but this project
slightly related to this question here . My problem: I am writing a bit
I need two divs to look a bit like this: | | ---| LOGO
I have a table that looks a bit like this actors(forename, surname, stage_name); I
I've got a query that looks a bit like this: select records.id, contacts.name +
I have a query that looks a bit like this: SELECT weekEnd, MAX(timeMonday) FROM
I have a test which looks a bit like this (I'm simplifying a bit
I have a report model looking a bit like this: class Report(models.Model): date =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.