Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
</head>
<body>
  <h1>A test</h1>
  <div id="test" data-id="5">
    
  </div>
</body>
</html>
 
$(function(){
  alert($("#test").data("id"));
  
  //set it
  $("#test").data("id", 10);
  alert($("#test").data("id"));
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers