The jQuery Slug Plugin is a simple plugin which can be used to generate post slugs based on the content of a text input field.
In a few steps, a regex and the replace() method are used to sanitize the val() of the field that slug() is initialized on, and the sanitized slug is inserted as the value of a hidden input field (you specify the class of the field to insert to), and also inserted into a span so the user can see the post slug. Optionally you can choose to show the input field and hide the span.