Skip to content
Advertisement

Only one button in my javascript function when I want two

I am doing an assignment for class and attempting to make a javascript function with a button to show the value on a slider component. However, the function only shows one button when there should be two. I am passing two values in my array. I can’t find the error. Any help would do.

DEMO.html

JavaScript

MakeSliderFW.js

JavaScript

Any help would be appreciated.

Here is an image better demonstrating my issue.

Current Situation

Advertisement

Answer

By replacing:

JavaScript

with:

JavaScript

you will also get buttonOut under first picture. The problem is with the way you are setting your onclick function inside for loop. That way you will always get last loop value inside callback, which is obviously not desired effect.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement