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 trialAttila Bongar
7,831 PointsColor sliders are not showing
After opening workspaces and previewing the initial code, the sliders dont show up when pressing the "new color" button. Anyone else has this issue?
3 Answers
Andrew Chalkley
Treehouse Guest TeacherHey there,
revealColorSelect
is an ID. You're missing a #
:)
Andrew Chalkley
Treehouse Guest TeacherHey Attila Bongar, Can you share your code?
Attila Bongar
7,831 PointsThan you , Andrew, for taking a look.
<!DOCTYPE html>
<html>
<head>
<title>Simple Drawing Application</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<canvas width="600" height="400"></canvas>
<div class="controls">
<ul>
<li class="red selected"></li>
<li class="blue"></li>
<li class="yellow"></li>
</ul>
<button id="revealColorSelect">New Color</button>
<div id="colorSelect">
<span id="newColor"></span>
<div class="sliders">
<p>
<label for="red">Red</label>
<input id="red" name="red" type="range" min=0 max=255 value=0>
</p>
<p>
<label for="green">Green</label>
<input id="green" name="green" type="range" min=0 max=255 value=0>
</p>
<p>
<label for="blue">Blue</label>
<input id="blue" name="blue" type="range" min=0 max=255 value=0>
</p>
</div>
<div>
<button id="addNewColor">Add Color</button>
</div>
</div>
</div>
<script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
var color = $(".selected").css("background-color");
$(".controls li").click(function() {
//deselect sibling elements
$(this).siblings().removeClass("selected");
//select clicked element
$(this).addClass("selected");
//cache current color
color = $(this).css("background-color");
});
//when new color is pressed
$("revealColorSelect").click(function() {
//show or hide color selector
$("#colorSelect").toggle();
});
Attila Bongar
7,831 PointsAttila Bongar
7,831 PointsBut of course! Haha! Thank you Andrew! Its awesome that a teacher who is on the actual video, takes time to help. I like Treehouse a lot.
Andrew Chalkley
Treehouse Guest TeacherAndrew Chalkley
Treehouse Guest TeacherTreehouse likes you too :)