Skip to content

Instantly share code, notes, and snippets.

@amphibian
Created April 20, 2011 14:33
Show Gist options
  • Save amphibian/931490 to your computer and use it in GitHub Desktop.
Save amphibian/931490 to your computer and use it in GitHub Desktop.
jQuery snippet to truncate unruly links (usually posted in your comments section)
$('#comments a').each(function(){ var str = $(this).text().split(' '); if(str[0].length > 30){ $(this).html($(this).text().substr(0,30) + '[…]'); } });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment