Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <title>jQuery data function TEST</title>
    <script src="//code.jquery.com/jquery-2.0.3.js"></script>
  </head>
  <body>
    <h1><div>CLICK ME!</div></h1>
    
  </body>
</html>
 
$(function(){
  console.log("started");
  $('h1').data({'testBool':false}).click(test);
});
function test(){
  console.log("click");
  if($('h1').data('test-bool'))
    console.log("Second click... or is it?!");
  else
    $('h1').data('test-bool',true);
}
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers