Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
    <script src="_so/js?" id="so"></script>
    <meta charset="utf-8">
    <title>Demo by Roko C.B.</title>
  </head>
  <body>
    <div class="post"></div>
    <div class="post" style="background-color:rgb(64,64,64);"></div>
    <div class="post" style="background-image:url(https://farm7.staticflickr.com/6039/6890125830_85a18ec397_b.jpg)"></div>
        
  </body>
</html>
 
.post {
    height:100px;
    width:100%;
}
 
$(".post").each(function() {
  var cs = window.getComputedStyle(this);
  if (cs.backgroundImage==="none" &&
      cs.backgroundColor==="transparent" ||
      /0\)$/.test(cs.backgroundColor) ) {
    var color = "hsl("+ ~~(Math.random()*360) +",60%,70%)";     
    $(this).css("background-color", color);   
  }
});
Output

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

Dismiss x
public
Bin info
roXonpro
0viewers