I do campaigning if this post is too old, and if my post is not according to the correct standard, since it is published for the first time, please correct me if this is terribly bad: -]
But in case someone else runs into this, I had similar problems with how the dynamic data is displayed, and I used jsfiddles and the comments above as help, and this is what helped me work, something like of my solution, I donโt have a button to load the downloaded data automatically when the page loads.
Updated In my .html file:
<div id="members"></div> <input type="button" id="load" value="test"/>
Updated In my .js file:
$("#load").click(function(){ var name = ["NameOne","NameTwo", "NameThree"]; var fset = '<fieldset data-role="controlgroup" id="members-ctrlgroup"><legend>This is a legend:</legend>'; var labels=''; for ( var i = 0; i < name.length; i++) { labels += '<input type="checkbox" class="checkbox" id="c' + i + '"><label for="c' + i + '" data-iconpos="right">' + name[i] +'</label>'; } $("#members").html(fset+labels+'</fieldset>'); $("#members").trigger("create"); });
I know that the โfieldโ looks a little strange as I shared it, but I find it a little easier when it comes to the fact that this whole line is correct in these cases.
Updated . To have rounded corners and have it as one control group, you will have to use this approach. Just as the former posters showed. Note that an identifier with a flag and a label for = may tend to blame the output if they do not match: -]
fiddle
source share