Simple javascript number multiplier function (I'm still very inexperienced)

Stack Overflow community! I've always searched this site for answers to questions, but I'm at a standstill for what I'm trying to achieve currently, and unfortunately where my programming knowledge ends is css and html, I know almost nothing when it comes to javascript.

Here's a slider project I'm trying to work on:

I've made a ton of changes to the original slider script based on my limited knowledge already, but what I need to do next is essentially duplicate the "downText" div behind the slider, and be able to paste it in a different location on the page, with a different number based on the "downText"

So the other numbers will actively update just like the "downText" div automatically updates, but the numbers they update with will be based on what is selected via the slider. So if someone selects "100", they will see the four numbers below it as:


I'd like to include the dollar signs also but still have it function properly, and I'm assuming all of this is very easily achievable by simply adding a code that grabs the "downText" number and multiplies it, then posts the result. I just don't know how to code with javascript so even though I'm sure it's a super simple function, I'm clueless as to how to do it, or how to learn how to do it myself.

Any help would be much appreciated. Thank you!

Answers 1

  • Not bad for beginning javascript at all! I remember personally yelling at my screen trying to do the most simplistic things.

    First, I would suggest you do a little bit more research on the formatting as there are other examples on Overstack that you can use (such as here)

    Second, it looks like for getting the value you need, you should be able to use dragVal:

    function dragUpdate() {
    dragVal = Math.round(( / maxDrag) * 1000);
    select('.downText').textContent = select('.upText').textContent = dragVal;'#display', 1.3, {
    }) ...

    It should operate on the last number that is selected, in which case simple use that number, times by the specified floats you want, and then format it with the source I provided. Hope that helps!

Related Articles