I have code that generates multiple signature pads on a page, giving them a unique ID along the way. I would like to be able to do individual signaturePad.toDataURL() calls as I process a button click, by looping through the canvas elements. I would also like to do single signaturePad.clear() functions as required.
I haven’t been able to figure out how to refer to the signature-pad instance that is attached to a given canvas element.
For clearing the signature, I’ve tried
$jq("body").on("click", ".signature-clear", function() {
var canvas = document.getElementById($jq(this).closest('.canvas-wrap').find('canvas').attr('id'));
var signaturePad = canvas.signaturePad();
});
But despite the canvas element being correctly targeted, I get the canvas.signaturePad is not a function error.
I’m sure it will be simple