I want to use my input ranger to set my colors but it's not working that's my js code please help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to use my input ranger to set my colors but it's not working that's my js code please help me

<script type="text/javascript"> var input = document.querySelectorAll("input"); for (var i = 0; i < input.Lenght; i++){ input(i).addEventListener("input", function(){ var red = document.getElementById("red").value, blue = document.getElementById("green").value, green = document.getElementById("blue").value; var display = document.getElementById("display"); display.style.background = "rgb("+red+ ","+green+ ","+blue+")"; },false); }

16th Aug 2020, 8:57 PM
maxi steve
maxi steve - avatar
11 Answers
+ 2
I can't tell much without looking at code but assuming you did everything right except that input(i) which should be input[i] instead !
16th Aug 2020, 9:23 PM
Abhay
Abhay - avatar
+ 2
You need to link your code using "+" if you can ,I can't help much without knowing the errors and it isn't readable this way
16th Aug 2020, 9:37 PM
Abhay
Abhay - avatar
+ 2
maxi steve you can either copy the url of the code and paste it here using those 3 dots that you may have seen when working with code or use "+" sign to insert your code
16th Aug 2020, 9:44 PM
Abhay
Abhay - avatar
+ 2
maxi steve check the code yourself ,it's length not Lengt And it is input[i] not input[1]
16th Aug 2020, 10:25 PM
Abhay
Abhay - avatar
+ 2
✌️,
16th Aug 2020, 11:22 PM
Abhay
Abhay - avatar
+ 1
I have re write the code already and it work thanks so much for your effort
16th Aug 2020, 11:18 PM
maxi steve
maxi steve - avatar
0
<div class="picker"> red<input type="range" min="0" max="255" step="1" id="red" value="115"> green<input type="range" min="0" max="255" step="1" id="green" value="30"> blue<input type="range" min="0" max="255" step="1" id="blue" value="200"> <div id="display"> </div> </div> This is my Html but after changing it, it does not work also
16th Aug 2020, 9:36 PM
maxi steve
maxi steve - avatar
0
How can i send the link of the code
16th Aug 2020, 9:41 PM
maxi steve
maxi steve - avatar
16th Aug 2020, 9:46 PM
maxi steve
maxi steve - avatar
0
That's my code
16th Aug 2020, 9:47 PM
maxi steve
maxi steve - avatar
0
Please how can i make it work
16th Aug 2020, 9:53 PM
maxi steve
maxi steve - avatar