I'm working on an app in CodeIgniter, and I am trying to make a field on a form dynamically generate the URL slug. What I'd like to do is remove is punctuation, convert it to lowercase, and replace the spaces with hyphens. So for example, Shane's Rib Shack would become shanes-rib-shack.
Here's what I have so far. the lowercase part was easy, but the replace doesn't seem to be working at all, and I have no idea to remove the puncuation:
$("#Restaurant_Name").keyup(function(){
var Text = $(this).val();
Text = Text.toLowerCase();
Text = Text.replace('/\s/g','-');
$("#Restaurant_Slug").val(Text);
});