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

The Archive Base Latest Questions

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

trying to create a simple slider for an input. Using a survey gem that

  • 0

trying to create a simple slider for an input.

Using a survey gem that adds extra fields. I added a class called “jSlider” to the question and does display the slider, but does not update the input.

html form generated:

<fieldset class="q_default jSlider" id="q_353" name="17) On a scale of 0 to 10, ...">
  <legend><span>17) On a scale of 0 to 10, ...</span></legend>
  <ol><span class='help'></span>
    <input id="r_18_question_id" name="r[18][question_id]" type="hidden" value="353" />
    <input class="" id="r_18_answer_id" name="r[18][answer_id]" type="hidden" value="3840" />
    <li class="string optional" id="r_18_string_value_input"><input id="r_18_string_value" maxlength="255" name="r[18][string_value]" type="text" /></li>
  </ol>
</fieldset>

My js is:

$(".jSlider").each(function(){
    var newSlider = '<div style="margin-top:20px;margin-bottom:20px;" id="slider">0</div><br />';
    $(this).append(newSlider);
    $("#slider", this).slider({
        value:0,
        min: 0,
        max: 10,
        step: 1,
        slide: function( event, ui ) {
            alert(ui.value);
            // when append, it adds to the fieldset
            // first parent is the fieldset, next should be the ol, then the li 
            //       finally arriving at the input field
            $(this).parent().next("ol").next("li").next("input:text").val(ui.value);

                    }

    });

   });

EDIT

Proposed edit to fix duplicate id breaks again.

$(".jSlider").each(function(){
    var id = $(this).attr("id");
    var sliderID = id + "_slider";  
    alert(sliderID);
    var newSlider = '<div id="' + sliderID + '"></div><br />';
    $(this).append(newSlider);
    // or even
    // $(sliderID).slider({
    $(sliderID, this).slider({
        value:0,
        min: 0,
        max: 10,
        step: 1,
        change: function( event, ui ) {
               // alert(ui.value);
                // when append, it adds to the fieldset
                // first parent is the fieldset, next should be the ol, then the li 
                //       finally arriving at the input field
                $(this).closest('fieldset').find('input:text').val(ui.value);

                        }

    });

   });
  • 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-24T03:27:20+00:00Added an answer on May 24, 2026 at 3:27 am

    You could do (you should use the stop event or the change event):

        stop: function( event, ui ) {
            alert(ui.value);
            // when append, it adds to the fieldset
            // first parent is the fieldset, next should be the ol, then the li 
            //       finally arriving at the input field
            $(this).closest('fieldset').find('input:text').val(ui.value);
    
                    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to create a simple loop that creates 50 buttons, adds them to
I am trying to create a simple user control that is a slider. When
Im trying to create a simple pan and zoom app using silverlight 4, but
I am trying to create a simple dialog in MFC using Visual C++. My
I am trying to create a simple page that enters data in to a
I'm trying to create a simple toggling sidebar using jquery, where it expands and
I am trying to create a simple mouseover effect using a combination of mouseover,
I'm trying to create a simple database table using the PHP MySQL query Create
I am trying to create a simple iPhone application using HTML/JavaScript/CSS with the help
Just trying to create a simple method that counts up 1 on the tally

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.