1

I am storing a value in localStorage.

I'm looking to insert this value into the input field value with Javascript. How do I do this?

Demo: http://jsfiddle.net/5apg1mh3/

localStorage.setItem("email", "test");
<input type="text" value="" id="email" name="email"/>

0

1 Answer 1

6

document.getElementById('email').setAttribute('value', localStorage.getItem('email'));

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.