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 6359009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:27:46+00:00 2026-05-24T23:27:46+00:00

I have setting up some sliders on 1 page but when you slide 1

  • 0

I have setting up some sliders on 1 page but when you slide 1 slider the amount of all the sliders change…

How can i make a slider seperate from each other? And if it is not to mutch work how can i use a span instead of a inputfield for showing the amount?

JS:

$(".slider").each(function () {
    $(".slider-range").slider({
        range: true,
        min: 0,
        max: 100,
        values: [30, 60],
        slide: function (event, ui) {
            $(".amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
        }
    });
    $(".amount").val("$" + $(".slider-range").slider("values", 0) + 
                     " - $" + $(".slider-range").slider("values", 1));
});      

HTML:

 <div class="slider">
      <b>Price range:</b>
      <input type="text" class="amount" />
      <div class="slider-range"></div> 
 </div>
  • 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-24T23:27:46+00:00Added an answer on May 24, 2026 at 11:27 pm

    Haven’t tested it but I’m pretty sure it’s an issue of not using any kind of scoping when finding “.slider-range” and “.amount” elements. The way you doing it, you’re basically attaching handler for “slide” event for every “.amount” element X times (where X is a number of “.slider” elements on page).

    My fix:

    $(".slider").each(function () {
        // $this is a reference to .slider in current iteration of each
        var $this = $(this);
        // find any .slider-range element WITHIN scope of $this
        $(".slider-range", $this).slider({
            range: true,
            min: 0,
            max: 100,
            values: [30, 60],
            slide: function (event, ui) {
                // find any element with class .amount WITHIN scope of $this
                $(".amount", $this).val("$" + ui.values[0] + " - $" + ui.values[1]);
            }
        });
        $(".amount").val("$" + $(".slider-range").slider("values", 0) + " - $" + $(".slider-range").slider("values", 1));
    });    
    

    EDIT: I forgot to put var before declaring $this variable. I’ve tested it and now it looks alright 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view where the user can change some settings, its basically a
I have custom slider sitting at the top of my page but I'm having
I'm setting some Microdata for products sold by 3rd parties. I have the location
I have a application for android 2.3.3 where I am setting some custom titles
So I have some settings that are of the user scope, but for some
i have a setting page in my application at 4th page and when i
i have this layout and once im setting some data dynamically layout doesn't resize
I am trying to make some text scroll vertically using jQuery, I have been
I have some forms on my page with a feedback panel. the formcomponents have
i have a select with some options generated from content: <select style=color: #444;> <?php

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.