Modify ↓
Ticket #5696 (closed enhancement: wontfix)
Minor Feature: Slugify
| Reported by: | umbrae | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | 1.4 |
| Component: | unfiled | Version: | 1.3.2 |
| Keywords: | Cc: | umbrae@… | |
| Blocking: | Blocked by: |
Description
Not a huge deal, but I find a function to turn text into a URL friendly slug like this often useful:
jQuery.slugify = function(s) {
return s.replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase();
}
Might be worth sticking into jQuery core for everyone else. (Although I know that string operations are extremely sparse in the jQuery framework. Only trim() as far as I know.)
If this is worth a patch, I can spend the minute and turn it into one. Let me know.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This isn't something that we're going to be landing - should make for a fine plugin, though.