- Posts: 23
- Thank you received: 2
Ask the community, share ideas, and connect with other LimeSurvey users!
<h2>Signature</h2> <div class="wrapper"><canvas class="signature-pad" height="200" id="signature-pad" style="background:#E4E4E4;" width="600"></canvas></div> <div><button id="save">Save Signature</button><button id="clear">Clear Signature</button></div> <script type="text/javascript" src="/limesurvey/scripts/signature_pad.min.js"></script><script type="text/javascript" charset="utf-8"> $(document).ready(function() { var signaturePad = new SignaturePad(document.getElementById('signature-pad'), { backgroundColor: 'rgba(255, 255, 255, 0)', penColor: 'rgb(0, 0, 0)' }); var saveButton = document.getElementById('save'); var cancelButton = document.getElementById('clear'); saveButton.addEventListener('click', function (event) { //event.preventDefault() var data = signaturePad.toDataURL('image/png'); // Send data to server instead... window.open(data); }); cancelButton.addEventListener('click', function (event) { event.preventDefault() signaturePad.clear(); }); }); </script><!-- https://github.com/szimek/signature_pad -->
localStorage.setItem("signature1", data);
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { document.getElementById("imageSignature1").src = localStorage.getItem("signature1"); }); </script>