I’m using the following code in order to put mobile styling on an input form:
items.push('<form id="flatmetrics"><table >');
for (i = 0; i < len; i += 1) {
row = resultflat.rows.item(i);
if (row.currentmetric == 0) {
items.push('<tr><td width="20%"><label for="' + row.flatno + '">' + row.flatdescription + '</td><td width="20%">' + row.previousmetric +'</label></td><td width="60%"><input type="number" name="' + row.flatno + '" id="' + row.flatno + '" flat="' + row.flatdescription + '" building="' + row.buildingcode + '" class="field" value="' + row.previousmetric + '"/></td></tr>');
}
else {
items.push('<tr><td width="20%"><label for="' + row.flatno + '">' + row.flatdescription + '</td><td width="20%">' + row.previousmetric +'</label></td><td width="60%"><input type="number" name="' + row.flatno + '" id="' + row.flatno + '" flat="' + row.flatdescription + '" building="' + row.buildingcode + '" class="field" value="' + row.currentmetric + '"/></td></tr>');
}
}
items.push('</table></form>');
$('#entriesflatFM').show();
$('#entriesflatFM').html(items.join('\n')).page();
After the first visit the form does not have the enhanced style.
Does anyone know why this is?
Have you tried
.trigger('create')?Or perhaps select the new
<form>element before using.trigger('create'):Also you are using the same selector twice in a row, you should chain your function calls when possible:
can be:
Update
If none of this works then you could try calling the specific widget functions for each type of widget: