Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <style type="text/css">
    article {
      display: block;
      background: #ccc;
    }
    article::before {
        content: attr(data-parent);
    }
    article[data-columns='3']{
      width: 400px;
    }
    article[data-columns='4']{
      width: 600px;
    }
  </style>
</head>
<body>
<article 
  id="electriccars"
  data-columns="3" 
  data-indexnumber="12314" 
  data-parent="cars">
</article>
  
  
<script>
var article = document.querySelector('#electriccars'),
        data = article.dataset;
alert(data.columns);
// data.columns -> "3"
// data.indexnumber -> "12314"
// data.parent -> "cars"
article.dataset.parent = 'vehicles';
alert(data.parent);
</script>  
</body>
</html>
Output

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

Dismiss x
public
Bin info
codepo8pro
0viewers