javascript sanitize input slug code example
Example: javascript sanitize input slug
// https://stackoverflow.com/a/1054862/485063
jq('.input.slug, .slug, input .slug').unbind().bind('keyup paste', function(){
var low= jq(this).val().toLowerCase()
.replace(/ /g,'-')
.replace(/\_/g,'-')
.replace(/[^\w-]+/g,'')
.replace(/\-\-+/g,'-');
jq(this).val(low);
});