I created a self-contained example to find out why this only works 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 web browser browser or even IE does not work on this line:
li.append(this);
this is an HTMLInputElement. Any ideas?
Thanks Pete
source
share