elementnot a jQuery object, the second argument to the function $.eachreturns its own DOM node
$.each($('#TableBody tr:gt(0)'), function(index, element){
$(element).find('td').last().html($('<span/>', {"class": "input-group-addon", text: 'Auswählen'}));
});
Also note that this classis a reserved keyword in javascript and should be specified.
It can also be written
$('#TableBody tr:gt(0)').each(function(index, element) {
$(element).find('td').last().html(
$('<span/>', {
"class" : "input-group-addon",
text : 'Auswählen'
})
);
});
which is more readable imo.
source
share