title: JQuery - Switch case depending on checkbox checked
body: <p>I'm a designer trying to learn Jquery and I'm having a problem with a current project. I need to be able to click a checkbox which in turn reveals a div. For each checkbox clicked a different div must be generated. I thought a switch function would do the trick but I haven't been able to figure out how to implement it. Here is what I have so far:</p>
  
  <pre><code>&lt;div"&gt;
      &lt;input type="checkbox" id="test1" /&gt;
  &lt;/div&gt;
  &lt;div&gt;
      &lt;input type="checkbox" id="test2" /&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  
  $(function () {
      $(':checkbox').click(function () {
          if ($(this).prop('checked', true)) {
              switch(this.id) {
  
                      case "test1";
                      var newDiv = $('&lt;div&gt;&lt;p&gt;it worked!!&lt;/p&gt;&lt;/div&gt;');
  
              break;
  
              case "test2";
                      var newDiv = $('&lt;div&gt;&lt;p&gt;it worked again!!&lt;/p&gt;&lt;/div&gt;');
  
              break;
  
              default;
              }
              newDiv.insertAfter($(this));
  
              $(this).after(newDiv);
          } else {
              $(this).next().filter('div').remove();
          }
      });
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I hope someone can help!</p>