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 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
  .radio_image {
    display: inline-block;
    width: 20px; height: 20px;
    margin: 10px;
    background: #ccc;
  }
  .radio_image.checked {
    background: green;
  }
  input { display: none; }
</style>
</head>
<body>
  
  <label for="radio1">
    <span class="radio_image"></span>
    <input name="radiogroup" type="radio" id="radio1" >
  </label>
  <label for="radio2">
    <span class="radio_image"></span>
    <input name="radiogroup" type="radio" id="radio2" >
  </label>
  
</body>
</html>
 
var radios = $('input:radio');
radios.change(function() {
    radios.filter(':checked').prev().addClass('checked');
    radios.filter(':not(:checked)').prev().removeClass('checked');
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers