javascript sanitize input slug

Solutions on MaxInterview for javascript sanitize input slug by the best coders in the world

showing results for - "javascript sanitize input slug"
Sofie
22 May 2016
1	// https://stackoverflow.com/a/1054862/485063
2	jq('.input.slug, .slug, input .slug').unbind().bind('keyup paste', function(){
3		var low=	jq(this).val().toLowerCase()
4			.replace(/ /g,'-')
5			.replace(/\_/g,'-')
6			.replace(/[^\w-]+/g,'')
7			.replace(/\-\-+/g,'-');
8		
9		jq(this).val(low);
10	});
11