Basically the problem I have is that I do not know how to hide the input
and the button with localstorage
, so when I refresh the page I do not show the input
or the button, just the name.
HTML
<span id="label-user"></span><br>
<input type="text" id="inpuname" />
<input type="button" onclick="saveLogin()" value="Save" id="save"/>
JavaScript
function saveLogin(){
var labelUser = localStorage.getItem("usuarioname");
$("#label-user").text(labelUser);
localStorage.setItem( "usuarioname", document.getElementById("inpuname").value );
document.getElementById("label-user").innerHTML += document.getElementById("inpuname").value;
};
saveLogin()
jQuery(function(){
jQuery('#save').click(function(){
jQuery('#inpuname').hide();
jQuery('#save').hide();
});
});
Code link