-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Save Image to LocalStorage #62
Comments
That should be pretty easy: saveButton.addEventListener("click", function (event) {
localStorage.setItem('signature', signaturePad.toDataURL());
});
// and later
img.src = localStorage.getItem('signature'); |
Thanks... im getting img.src is not defined. how would i define it? |
It was just an example. You need to create image element: var img = document.createElement('img');
img.src = localStorage.getItem('signature');
// Add image to the page
document.body.appendChild(img); |
nevermind. i created a seperate variable for the image and it worked! thanks a million! |
You're welcome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally got my pad working... its lovely. My question is... how do I get my signature image to set to localStorage? I'd like the base64 image or dataURI to store in local storage. My goal is to export the image into an html page which will be pdf'd. Any help with this would be great.
The text was updated successfully, but these errors were encountered: