Last active
April 1, 2016 12:57
-
-
Save biganth/247d1b5ae748bfbfa621 to your computer and use it in GitHub Desktop.
Create urls based on blog post title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Turns "My first blog post" into my-first-blog-post | |
function slugIt() { | |
let title = document.getElementById("title"); | |
let slug = document.getElementById("slug"); | |
slug.value = title.value.replace(/ /g, "-").toLowerCase(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment