Answers for "javascript sanitize input slug"

0

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);
	});
Posted by: Guest on February-05-2021
0

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);
	});
Posted by: Guest on February-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language