I have a very strange problem with switches in jQuery Mobile. I fill some radio objects with ajax. When I do this for the first time, this is normal, but any subsequent loads seem to cause problems with the display - each flag is displayed separately, and not in the same list.
function getWords() {
var gig_id = $('#gigs').val();
$.ajax({
url: Nnn.serverLocation+'/words?gigid='+ gig_id,
success: function(data) {
Nnn.words = eval('(' + data + ')');
displayWords();
}
});
}
function displayWords() {
$('#word_container').html('<fieldset data-role="controlgroup" id="words"></fieldset>');
$('#words').html("<legend>It's:</legend>");
$.each(Nnn.words, function(key, value) {
$('#words').append('<label for="'+value.Word+'" >'+value.Word+'</label><input type="radio" value="'+value.Word+'" id="'+value.Word+'" name="radio-choice-1" />');
});
$('#words input').checkboxradio();
$('body').page();
}
HTML looks like
<div id='all' data-role="page">
<div data-role="content">
<div data-role="fieldcontain" id='word_container'>
<fieldset data-role="controlgroup" id='words'>
</fieldset>
</div>
</div>
It drives me crazy!
source
share