Saving CSS while dynamically creating checkboxes with jQuery / JQM
I have some code that takes values ββfrom a database and uses them to dynamically create a set of checkboxes:
$("#cTable").append('<fieldset data-role="controlgroup"> <legend>Option</legend>');
cDest = "includes/loadCategories.php";
$.getJSON(cDest, function(data) {
cInfo = data.items;
$.each(cInfo, function(index, info) {
$("#cTable").append('<input type="checkbox" name="cat" id="cat_' + info.S_ID + ' class="ui-checkbox" value="' + info.S_ID + '" /><label for="chkCat_' + info.S_ID + '">' + info.S_Name + '</label> </br>');
});
$("#cTable").append('</fieldset>');
});
The problem is that these newly created checkboxes do not accept the jQuery Mobile CSS styling. Is there a way to assign JQM css to this dynamically generated element?
I was thinking about using the JQuery.CSS () function, but since I really don't know what CSS is needed (since it's part of JQM by default), I don't think I can use this method.
thank
+3
source to share