Javascript/jQuery permalink converter...


/ Published in: JavaScript
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. $('#permalink').val($(this).val().replace(/\s/g, '-').replace(/[^\w/-]/g, '').toLowerCase());

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.