Question: So I'm trying to load dynamic content straight into my checkbox container (group\_checkboxes)

```
<div id='group_checkboxes' data-role="fieldcontain">

</div>

```

This is the statement I'm running to populate the container:

```
$('#group_checkboxes').append('<fieldset data-role="controlgroup"><input type="checkbox" name="' + $(this).find('data').text() + '" class="custom" /><label for="' + $(this).find('data').text() + '">' + $(this).find('label').text() + '</label></fieldset>');

```

The checkboxes are all populated but the jQuery style is not applied.

According to the [docs](http://jquerymobile.com/demos/1.0a4.1/#docs/forms/forms-checkboxes.html) all I need to do is call this function to update the checkbox style...

```
$("input[type='checkbox']").checkboxradio("refresh");

```

That doesn't work though... Any idea what I'm doing wrong?

Answer: 
First try their own static demo code:

```
<div  data-role="fieldcontain">
                <fieldset data-role="controlgroup">
                    <legend>Choose as many snacks as you'd like:</legend>
                    <input type="checkbox" name="checkbox-1a" id="checkbox-1a" class="custom" />
                    <label for="checkbox-1a">Cheetos</label>

                    <input type="checkbox" name="checkbox-2a" id="checkbox-2a" class="custom" />
                    <label for="checkbox-2a">Doritos</label>

                    <input type="checkbox" name="checkbox-3a" id="checkbox-3a" class="custom" />
                    <label for="checkbox-3a">Fritos</label>

                    <input type="checkbox" name="checkbox-4a" id="checkbox-4a" class="custom" />
                    <label for="checkbox-4a">Sun Chips</label>
                </fieldset>
            </div>

```

They are using just one fieldset as I mentioned in comments.  

If this works, then adjust your script to generate the same markup dynamically and then refresh them

```
$("input[type='checkbox']").checkboxradio("refresh");

```

If this will work with their code, you will know that you have error in markup. If not, there is an error with that refresh function. (I know it's not final solution but you have to do a bit of debugging sometimes :)

Edit:  

Found similar problems, solved by using `Page()`  

[JQM FAQ](http://jquerymobiledictionary.dyndns.org/faq.html)  

[SO Question](https://stackoverflow.com/questions/4039428/jquery-mobile-dynamically-creating-form-elements)
What work out for me was to remove the whole fieldset then replace place a new fieldset with the new item I wanted to add then I called the `.trigger('pagecreate');` method on the whole page. This is not the most efficient solution but that is the only one that worked in my case.