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 trial

JavaScript jQuery Basics (2014) Creating a Password Confirmation Form Perfect

its dont drawing anything. please help

var color = $(".seleted").css("background-color");
var $canvas = $("canvas");
var context = $canvas[0].getContext("2d");
var lastEvent;
var mouseDown = false;

$(".controls").on("click", "li", function(){



    color = $(this).css("background-color");



function changeColor() {
   var r = $("#red").val();
    var g = $("#green").val();
    var b = $("#blue").val();
    $("#newColor").css("background-color", "rgb(" + r +"," + g + ", " + b +")" );



    var $newColor = $("<li></li>");
    $newColor.css("background-color", $("#newColor").css("background-color"));
    $(".controls ul").append($newColor);



    lastEvent = e;
    mouseDown = true;


    if(mouseDown) {
    context.moveTo(lastEvent.OffsetX, lastEvent.OffsetY);
    context.lineTo(e.OffsetX, e.OffsetY);
    context.strokeStyle = color;

    lastEvent = e;
    mouseDown = false;


Hey Henrik, can u please create and paste your workspace snap link so we can track reason due to which code is not working..!

2 Answers

in workspace on rightside snapshot_workspace tool is available > take snapshot >paste the link of snapshot here & if u want to check out the mistake yourself you can check out my code here http://codepen.io/mehra_as/pen/jWKRzW