Alright I asked the guy that did the library and he showed me the right answer. In case you need it, here it is:
Well, rather than having a click event bound to the canvas element, set up a click event for each new jCanvas layer. When you click one of those layers, have the callback function switch between what it's going to do, based on some layer property that you create (such as layer.selected). Here's the basic idea:
$("canvas").drawImage({
// image properties here...
layer: true,
name: "someLayer",
selected: false,
click: function(layer) {
if (layer.selected === false) {
layer.selected = true;
// do something with the layer name
} else if (layer.selected === true) {
layer.selected = false;
// deselect the layer
}
}
});
-Caleb