function save_options() { var url = document.getElementById('url').value; localStorage.setItem("url", url); alert(url); } function url() { document.getElementById("url").value=localStorage.getItem("url"); } document.getElementById('save').addEventListener('click', save_options); url();