title: jQueryMobile uncaught exception when REMOVING checkboxradio
body: <p>Getting this message:</p>
  
  <pre><code>Error: cannot call methods on checkboxradio prior to initialization; 
  attempted to call method 'refresh'
  </code></pre>
  
  <p>i followed the demo found here: <a href="http://www.uglymongrel.com/jqm/touch/demos/examples/controlgroups/dynamic-controlgroup.php" rel="nofollow noreferrer" title="Ugly Mongrel">Ugly Mongrel</a></p>
  
  <p>Here's a snip of my JS:</p>
  
  <pre class="lang-js prettyprint-override"><code>function(){
    var $pbNum = $('&lt;input checked="checked" id="component-pbnum-'+ _val+ 
          '" name="component-pbnum[]'+
          '" type="checkbox" value="'+ _val+ '" data-mini="true"&gt;'+
          '&lt;label for="component-pbnum-'+ _val+ '"&gt;'+ _val+ '&lt;/label&gt;'),
        $pbNumChk = $($pbNum[0]).on("change", function(ev){
          $pbNum.remove();
          // UNCAUGHT EXCEPTION: "cannot call methods on checkboxradio prior
          // to initialization; attempted to call method 'refresh'"
        });
  
    $pbnumList.controlgroup("container").append($pbNum);
    $pbNumChk.checkboxradio();
  // Have also tried $pbNumChk.checkboxradio().checkboxradio("refresh") 
  // as hinted by other answers. No difference.
  }
  </code></pre>
  
  <p>i need to add checkboxradio (checkboxes in this case) dynamically, but provide the ability to remove them when they're click/tapped.</p>
  
  <p>It's actually kinda frustrating how limited jQM seems to be compared to jQUI. No (documented) "destroy" method for these widgets? Anyway...</p>
  
  <p>Checkboxes add to my ControlGroup just fine. When i click to remove them in a full browser, they are removed, but an exception is thrown. Everything i've found so far answers with something similar to this:
  <a href="https://stackoverflow.com/a/15180600/258598">https://stackoverflow.com/a/15180600/258598</a></p>
  
  <p>Here's what i looked for: <a href="http://goo.gl/mVOdo" rel="nofollow noreferrer">http://goo.gl/mVOdo</a></p>
  
  <p>i don't get it. Why is JS throwing an error about the widget when i'm removing it - and especially when it WAS initialized when it was inserted?</p>
  
  <p>[EDIT]<br>
  Fixed a small typo in the $pbNum HTML string</p>