Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialOliver Duncan
16,642 PointsNew color span isn't updating while I'm sliding, only after I'm done sliding
In the video, it looks like Andrew's new color span updates as the slider moves. Mine only updates after I'm done sliding. I'll post my code as soon as I figure out how to take a snapshot.
3 Answers
Adam Futrell
11,976 PointsThis worked for me...
REPLACE
$("input[type=range]").change(changeColor);
WITH
$("input[type=range]").on("input", changeColor);
Adam Futrell
11,976 PointsThis is where I found my answer: http://stackoverflow.com/a/12797900/411256
Oliver Duncan
16,642 PointsThanks, works great. Now I'm just curious why .change() worked for Andrew but not for us!
Adam Futrell
11,976 PointsI think there certain things he used that are now deprecated, so they won't work. I believe this video series is 2 years old which is like 20 years in web programming.
Adam Futrell
11,976 PointsOh and could you also mark my answer as the answer for this question so other people can tell that this was addressed? Thanks!
Mike LaPan
5,190 PointsAwesome. Thanks for this!
Martin Cornejo Saavedra
18,132 PointsGreat input, this worked for me.
Carlos Enrique Castañeda Gutiérrez
13,886 PointsExcuse me, there is something I dont understand about your .on().
According to the documentation you should put an event like "click" and then the function. Why you put "input", is that an event? I dont think so, it looks like a selector? Am I missing something?
Thanks for you answer.
Oliver Duncan
16,642 PointsCarlos,
.click() is just shorthand for $.on("click", handler). Check out the docs for click and on.
Here's some info on 'input' too: https://developer.mozilla.org/en-US/docs/Web/Events/input
Oluwaseun Talabi
3,691 PointsThanks! I was having the same issue and changing it to ' $("input[type=range]").on("input", changeColor); ' worked for me as well.
Oliver Duncan
16,642 PointsOliver Duncan
16,642 Points