Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  
<img src="http://placehold.it/70x70" id="divid1">
<img src="http://placehold.it/30x50" height="12" width="12" id="hideid1" >
<div id="id1" class="hide">
  <img src="http://placehold.it/70x70" height="12" width="12" >
</div>
  
<br>
<button onclick="clearLocal()">Reset</button>
  
  
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
</body>
</html>
 
$("#divid1").click(function(){
    $("#divid1").hide(); //want this to keep hidden after refresh
    $("#hideid1").hide(); //want this to keep hidden after refresh
    $("#id1").show(); //want this to keep showing after refresh
    localStorage.setItem('hidden', true);
});
$(function() {
  // if localStorage has hidden as true, hide the div and show other
  if(localStorage.getItem('hidden')){
    $("#divid1").hide(); 
    $("#hideid1").hide(); 
    $("#id1").show();
  }
});
// Clear the storage
function clearLocal(){
  localStorage.clear();
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
mihailomisicpro
0viewers