jquery - Using map to get all but last in data array -
the following iterates on <th> elements , creates array of text, each array entry surrounded <span> tags.
but, don't ever need content of last <th> element - there way omit function?
var newcontent = $('#tablehead').find('th').map(function(){ return '<span>' + $(this).text() + '</span>'; }).get();
try using .slice(0, -1)
var newcontent = $('#tablehead').find('th').slice(0, -1).map(function(){ return '<span>' + $(this).text() + '</span>'; }).get();
Comments
Post a Comment