Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
 <div id="link-anchor" style="background-color:red; height:40px; color:white; width:50px;"></div> 
</body>
</html>
 
var linkAnchor = $('#link-anchor');
var randShareLink = Math.floor(Math.random() * 5) + 1;
$(document).ready(function(){
    if (randShareLink === 1){
    linkAnchor.append('case 1');
    } else if (randShareLink === 2){
       linkAnchor.append('case 2');
    } else {
    linkAnchor.append('case 3');
    }
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers