Hi I have written a function that is used to change text in a table cell, the table displays members of a team but is not in a readable format, so i have to convert the string output into a readable format.
This all works fine however I was wondering if anyone could help me re-factor this function as it seems abit crude ?
Jquery Code:
$(".membersName").each(function() {
var memberName = $(this).text();
var splitmemberName = memberName.split("=");
var finalNameSplit = splitmemberName[1].split(",");
$(this).empty();
$(this).append(finalNameSplit[0]);
});
Any help or tips would be greatly appreciated. Cheers in advance
Looks fine to me! You could use
RegExpinstead, but I can’t say that would be better. Although this:Could be shortened up to this: