Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<form>
<label><input type="radio" name="styleColor" id="black" checked="checked" onclick="styleChange()"/>Black</label>
<div class="dropdown-divider"></div>
<label><input type="radio" name="styleColor" id="red" onclick="styleChange()">Red</label>
<div class="dropdown-divider"></div>
<label><input type="radio" name="styleColor" id="green" onclick="styleChange()">Green</label>
<div class="dropdown-divider"></div>
<label><input type="radio" name="styleColor" id="blue" onclick="styleChange()">Blue</label>
</form>
</body>
</html>
 
function styleChange() {
  
   if (document.getElementById("black").checked) {
       console.log("Color selected: Black")
   }
   else if (document.getElementById("red").checked) {
       console.log("Color selected: Red")
   }
   else if (document.getElementById("green").checked) {
       console.log("Color selected: Green")
   }
   else if (document.getElementById("blue").checked) {
       console.log("Color selected: Blue")
   }
}
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers