var trunc='Autumn, please.'; function getLeadingHtml (input, maxChars) { var token = /\w+|[^\w<]|<(\/)?(\w+)[^>]*(\/)?>|"; return output; }; trunc = getLeadingHtml(trunc,47) trunc=(trunc+'...'); document.write('
');