Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.0.0.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div id="net">
    <div data-id="0">id 0</div>
    <div data-id="1" data-parent="0">id 1</div>
    <div data-id="2" data-parent="3">id 2</div>
    <div data-id="3" data-parent="0">id 3</div>
    <div data-id="4" data-parent="2">id 4</div>
    <div data-id="5" data-parent="3">id 5</div>
    <div data-id="6" data-parent="4">id 6</div>
    <div data-id="7" data-parent="1">id 7</div>
  </div>
</body>
</html>
 
div{
  min-width:300px;
  min-height:100px;
  background-color:rgba(0,0,0,.2);
  border:1px solid red;
  padding:10px;
  margin:10px;
}
#net{
  background:none;
}
 
$('#net').children().each(
function(i){
  $this = $(this);
  if(true){
    $this.append( $('div[data-parent='+$this.data('id')+']') );
    console.log($this.data('parent'));
  }
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers