Im trying to make a jquery color picker, it should read the background color of whatever element is clicked and return it in a .result div.
Problem: How do I describe “the currently clicked” element?
This is my code:
$("p").click(function () {
var color = $("p").css("background-color");
$(".result").html("That div is <span style='color:" +
color + ";'>" + color + "</span>.");
});
I want this to work for any element which is clicked, not only p. Is there a simple way to do this?
http://jsfiddle.net/tarabyte/9v2rA/