Color choosing
Color choosing
Hi,
I want to create a color picker so that when I click on 'color' div (at the end of this script) then the 'test' div becomes that color.
I'm really new to jquery - could someone please point me in the right direction for this?
Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jquery fun</title>
<style>
.test {
background-color:#FF0; width:60px; height:60px;
}
.color {
width:20px; height:20px; padding:10px; margin: 10px;
}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<div class="test"></div>
<div class="color" style="background-color:#F00;"></div>
<div class="color" style="background-color:#FF0;"></div>
<div class="color" style="background-color:#F0F;"></div>
<script>
$(".test").click(function () {
$(this).css("backgroundColor","#F00");
});
$(".color").click(function () {
});
</script>
</body>
</html>