/ Published in: JavaScript

A lovely little one liner that strips out all non alphanumeric chars first, then replaces the spaces with hyphens, then converts all to lowercase :D
Expand |
Embed | Plain Text
$('#permalink').val($(this).val().replace(/\s/g, '-').replace(/[^\w/-]/g, '').toLowerCase());
You need to login to post a comment.