Skip to content

Instantly share code, notes, and snippets.

@devloe
Last active August 29, 2015 14:07
Show Gist options
  • Save devloe/81d4b2b99e5afc9f8f77 to your computer and use it in GitHub Desktop.
Save devloe/81d4b2b99e5afc9f8f77 to your computer and use it in GitHub Desktop.
// Sluggify inputs with name attribute beggining
// with "title". The result is apply to inputs with
// attribute name beggning with "slug"
$(".form-extended").each(function()
{
var self = this;
var slug = $("[name^=slug]", self);
$("[name^=title]", self).on("keydown blur", function(){
if(this.value){
slug.val(_str.slugify(this.value));
}else{
slug.val("");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment