I want to give the option to change the drawing color after clicking on a color using jsignature. I cannot figure out how to pass the color to the plugin. Behold how I try, please help know where I'm wrong.
<table>
<tr>
<td style='background:green;width:40px;height:40px;' id="green" class='changeColor'></td>
<td style='background:blue;width:40px;height:40px;' id="blue" class='changeColor'></td>
<td style='background:red;width:40px;height:40px;' id="red" class='changeColor'></td>
</tr>
</table>
<div id="signature" style="width:500;height:400"></div>
$(document).ready(function() {
//default color
var pen ='green';
$('.changeColor').on('click', function(event) {
pen = $(this).attr('id');
});
var $sigdiv = $("#signature").jSignature({
'UndoButton':true,
'background-color': 'transparent',
'decor-color': 'transparent',
'color':pen,
'width': 500,
'height': 400
});