Hi Team
I need some help with my form, signaturepad is not signing meanwhile the buttons are working and dont have errors and yet im using the correct libraries.
// css code
#signature-pad {
display: flex;
align-items: center;
}
#signature-pad .sigWrapper {
height: 50px;
width: 300px;
border: 1px solid #ccc;
position: relative;
margin-right: 10px;
}
#signature-pad canvas {
position: absolute;
left: 0;
top: 0;
}
.signature-button {
margin-left: 10px;
}
// js code
$(document).ready(function() {
// initialize signature pad
var canvas = document.getElementById('signatureCanvas');
var signaturePad = new SignaturePad(canvas);
// handle clear button click
$('#clearSignatureButton').click(function(){
console.log('Clear button clicked!');
signaturePad.clear();
alert("Test1");
});
// handle save button click
$('#saveSignatureButton').click(function(){
var signatureDataURL = signaturePad.toDataURL();
alert("test2");
// send signature to the server.
$.ajax({
type:'POST',
url:'save_signature.php',
data:{
signature: signatureDataURL
}
}).done(function(response){
console.log(response);
});
});
});
// html code
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Naimish MakwanaPosted Mar 16, 2023, 8:41 AM
Hello Gcobani,
Again, it due to your CSS. PFB working link:
https://codepen.io/Naimishcon/pen/rNZvgqQ
Thanks
Naimish Makwana