Benutzer ausgewählten Wert von Auswahlbox auf Schaltfläche Wert in, aber es (Localstorage) Wert auf Aktualisierung der Seite ändert (F5)local Wert Reseting nicht auf Seite aktualisieren
function change(){
var opt = $("#gsb_tb option:selected").text();
var stored = localStorage.setItem('project',JSON.stringify(opt));
var valueofstore= JSON.parse(localStorage.getItem('project'));
document.getElementById("set-project").value= valueofstore;
}
<select id="gsb_tb" style="height: 45px; width: 78%; margin-left: 70px; padding-right: 90px; vertical-align: middle;" tabindex="0" autocomplete="off">
<option value="" disabled selected>Select your Project</option>
<option value="370"> E-Card</option>
<option value="278">Labs</option>
<option value="196">Absolute DB</option>
<input value="Set as Working Project" onclick="change()" aria-label="I'm Feeling Lucky" name="btnI" class='center-btn' jsaction="sf.lck" type="submit" id='set-project'>
Sie scheint zu laden, zu fehlen) '' 'nach localStorage.setItem ('project', JSON.stringify (opt); '. Es wird' JSON.stringify (opt)); ' –
Es gibt einen Syntaxfehler, nachdem 'JSON.stringify (opt)' one ')' – Livingstone
fehlt Ja, es funktioniert g, aber aber jetzt zurückgesetzt auf Seite aktualisieren –