I've created a self-contained example to find out why this is only working in Firefox:
var ul = jQuery('<ul></ul>');
jQuery(selector).children().each(function() {
var li = jQuery('<li></li>');
var label = '<label for="' + this.id + '">' + this.name + '</label>';
li.append(label);
li.append(this);
ul.append(li);
});
Any webkit browser or even IE fails on this line:
li.append(this);
this is a HTMLInputElement. Any ideas?
Thanks, Pete