i have a condition where i have to replace the empty space with '-' and all other symbols like " *,%,',@,$ ....etc" should be removed , so for instance if i have a word real life , it should be written as real-life , another example , if i have a words fire officer's association it should be written as fire-officers-association .
I can replace empty space using jquery like :
var product= $("#product").val().replace(/ /g,'-');
but i m struggling to remove the special characters
Can any provide any suggestion or advice on how to acheive that Thanks