I'm trying to save a URL into localstorage for my chrome extension. This URL is entered from a text input field in the popup. I just cannot get the script that saves the new value to work.
Heres my code:
popup.html:
<html>
<head>
<title>Favourite.es Settings</title>
<link rel="stylesheet" href="/mdl/material.min.css">
<script src="/mdl/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="/css/settings.css">
<link rel="stylesheet" href="https://code.getmdl.io/1.1.1/material.blue-light_blue.min.css" />
</head>
<body>
<script src="popup.js"></script>
<div class="container">
<img src="/img/Branding.png">
</div>
<div class="container">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="width: 80%; margin-left:30px;">
<input class="mdl-textfield__input" type="text" id="bgurl">
<label class="mdl-textfield__label" for="sample3">Background URL:</label>
</div>
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" style="margin-left:30px" onclick="save();">
Save
</button>
</div>
</body>
</html>
popup.js:
function save(){
console.log("Init SAVE");
var bgurl = document.getElementById("bgurl");
localStorage.setItem("bgurl", bgurl.value);
}