I have a user with a name Paul Steve Panakkal. It\'s a long name it won\'t fit to the div container. So is there anyway to split first name and lastname fro
if you assume the last word is the last name and a single word name is also a last name then ...
var items = theName.split(' '), lastName = items[items.length-1], firstName = ""; for (var i = 0; i < items.length - 1; i++) { if (i > 0) { firstName += ' '; } firstName += items[i]; }