Skip to content

Instantly share code, notes, and snippets.

@ihzarizkyk
Created October 12, 2020 10:56
Show Gist options
  • Save ihzarizkyk/f4fbbb3d8762501698b5d24b6d1024ff to your computer and use it in GitHub Desktop.
Save ihzarizkyk/f4fbbb3d8762501698b5d24b6d1024ff to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>LocalStorage HTML5 - FWD</title>
<script>
function save()
{
var storage = document.getElementById('inputan').value;
localStorage.setItem('Text',storage);
}
function show()
{
var showinputan = localStorage.getItem('Text');
if(showinputan)
{
sw = document.getElementById('show');
sw.innerHTML=showinputan;
}
}
function del()
{
localStorage.removeItem('Text');
}
</script>
</head>
<body>
<!--Local Storage HTML5-->
<h1>
Inputan Teks
</h1>
<input type="text" id="inputan">
&nbsp;&nbsp;
<input type="button" value="SIMPAN" onclick="save()">
&nbsp;&nbsp;
<input type="button" value="TAMPILKAN" onclick="show()">
&nbsp;&nbsp;
<input type="button" value="HAPUS" onclick="del()">
<br>
<p id="show"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment