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>
      <input type="radio" name="radiobutton" value="A" onclick = "populateData(event)">
      <input type="radio" name="radiobutton" value="B" onclick = "populateData(event)">
    
        <div id="content"></div>
    </body>
    </html>
 
    var targetDiv = document.getElementById('content');
        var htmlContent = '';
        
        function populateData(event){
          switch(event.target.value){
            case 'A':{
             htmlContent = 'Content for A';
              break;
            }
            case 'B':{
              htmlContent = "content for B";
    break;
            }
          }
          targetDiv.innerHTML = htmlContent;
        }
    
Output

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

Dismiss x
public
Bin info
clisterdmellopro
0viewers