var trunc='Nothing is a bigger buzzkill after a great night out than a throbbing hangover. Get on with your day as quick as you can with these tricks.'; function getLeadingHtml (input, maxChars) { var token = /\w+|[^\w<]|<(\/)?(\w+)[^>]*(\/)?>|"; return output; }; trunc = getLeadingHtml(trunc,47) trunc=(trunc+'...'); document.write('
');