title: how to remove elements from a div when checkbox is unchecked?
body: <p>how to remove elements from a div when checkbox is unchecked ?</p>
  
  <pre><code>function dispCmpName(id) {
  
              var campdip = $('#camp' + id).html();
              if ($("#campaign-name-disp").text().search("" + campdip) === -1) {
                  $("#campaign-name-disp").append('&lt;br/&gt;&lt;div id=campSub'+ id +'&gt;'+ campdip + '&lt;img src="./images/remove.png"alt="Delete Campaign" title="Delete Campaign" style="cursor: pointer" onclick="deleteCamp()"/&gt;'+'&lt;/div&gt;');
              } else {
                 alert(id);
                 $('#campaign-name-disp).remove(campdip);
              }
          }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;p id="campaign-name-disp"&gt;&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;input type="checkbox" class="checkBoxClass1" id="${campDetails.campaignId}" name="campaignId" value="${campDetails.campaignId}" onclick="dispCmpName(${campDetails.campaignId})"/&gt;
  
  &lt;td id="camp${campDetails.campaignId}"&gt;${campDetails.campaignName}&lt;/td&gt;
  </code></pre>
  
  <p>whenever i check a check box the <strong>dispCmpName</strong> function gets called and adds the campaign name under a div to the p tag with id <strong>campaign-name-disp</strong>. And when i uncheck the checkbox i want to remove that campaign name from my p tag using the div ids. Could anyone help me out in how to remove the name when unchecked.</p>
  
  <p>Note: each div id is unique. my div ids look like this </p>
  
  <pre><code>    &lt;p id="campaign-name-disp"&gt;
  &lt;div id="campSub382581148"&gt;campaign name 1&lt;/div&gt;
  &lt;div id="campSub382581148"&gt;campaign name 2&lt;/div&gt;
  &lt;/p&gt;
  </code></pre>