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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:07:35+00:00 2026-05-30T13:07:35+00:00

I am creating a calculator based on the jQuery UI range slider and have

  • 0

I am creating a calculator based on the jQuery UI range slider and have a setup that works. I have a bindEvents function in my application that binds the slider to the slide event:

    // this is where I bind all slide events
    bindEvents: function() {
        // hold on to the value of this
        var self = CloudCalc;

        // bind the slider's slide event to a data event
        self.sl.on('slide', this.setSliderOutputValue);             
    }

and then here is the handler that faithfully executes my event:

setSliderOutputValue: function (event, ui) {
        // hold on to the value of this
        var self = CloudCalc;

        // show the ui output value on slide event
        self.output.html( ui.value + " INSTANCE");  
}

Now I want to trigger multiple events when the user slides the slider. So I would like to use the observer pattern in this setup like so (using addyosmani’s pubsub plugin):

bindEvents: function() {
    // hold on to the value of this
    var self = CloudCalc;

    // bind the slider's slide event and publish it
    self.sl.on('slide', $.publish('slider/moved'));             
}

Here’s the subscription:

subscriptions: function () {
    $.subscribe('slider/moved', this.setSliderOutputValue);     
}

So when this subscription calls the setSliderOutputValue event, I get a console error saying:

Uncaught TypeError: Cannot read property 'value' of undefined

That means the reference to ui property is not getting passed to the setSliderOutputValue event.

How do I pass the ui property? Please correct me if I am doing this wrong.

  • 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-30T13:07:37+00:00Added an answer on May 30, 2026 at 1:07 pm

    So here is what I got working with a pubsub pattern. I added the $.publish call to the setSliderOutputValue method like this:

    setSliderOutputValue: function (event, ui) {
            // hold on to the value of this
            var self = CloudCalc;
    
            // show the ui output value on slide event
            self.output.html( ui.value + " INSTANCE");
            $.publish('slider/moved')   
    },
    

    And then added to my subscription like so:

    subscriptions: function () {
            $.subscribe( 'plan/results', this.parseJSON );      
            $.subscribe( 'slider/moved', this.setVMval );
            $.subscribe( 'slider/moved', this.setRAMval );
            $.subscribe( 'slider/moved', this.setHDval );           
    },
    

    And voila! I can now listen to and trigger multiple events based on a single event with my jQuery range slider.

    Any suggestions to improve this code by refactoring the multiple subscribe calls into one single call are welcome.

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

Sidebar

Related Questions

I have a small calculator that I am creating in C# (Sharp Develop). The
The Background: I have been creating a script that based on input csv's that
I am creating a simple calculator application. I have 10 buttons labelled 0 through
basically i'm creating a tariff calculator for a utility company in my country, based
I have problem in creating modular analysis architecture for C# application. Aim: It is
I am creating a forecasting application that will run simulations for various modes that
I am working on learning JQuery and creating a simple HTML / JS calculator.
I have been tasked with creating a program that will generate an amortization schedule.
Imagine you're creating a website that allows people to search for rental cars based
Hi I am creating a simple calculation based application and at end i need

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.