stringToSlug test

by Gabriel

HTML

<script src="https://leocaseiro.github.io/jQuery-Plugin-stringToSlug/bower_components/speakingurl/speakingurl.min.js"></script>
<script src="https://leocaseiro.github.io/jQuery-Plugin-stringToSlug/bower_components/jquery.stringtoslug/dist/jquery.stringtoslug.min.js"></script>
stringToSlug:
<input type="text" id="ranchName1">
<input type="text" id="ranchUrl1">

<div></div>

speakingurl:
<input type="text" id="ranchName2">
<input type="text" id="ranchUrl2">

JavaScript

$(function () {
	$("#ranchName1").stringToSlug({
  	setEvents: "keyup keydown blur",
    getPut: "#ranchUrl1",
    space: ""
  });
  
  $("#ranchName2").on("input keypress keydown keyup change blur", function () {
  	var ranchName = $(this).val();
    var slug = getSlug(ranchName, {
    	separator: "" // doesn't work with empty string
    });
    slug = slug.replace(/-/g, ""); // so we need this

  	$("#ranchUrl2").val(slug);
  });
});