This is not a jQuery question, it can be done using simple Javascript. First you need to enter the text in lowercase, then replace the spaces with periods, and then remove the non-alphanumeric characters:
var myStr = "Earth is 70% water, -!*#$^^ & 30% LAnd" myStr=myStr.toLowerCase(); myStr=myStr.replace(/ /g,"."); myStr=myStr.replace(/[^a-zA-Z0-9\.]+/g,"");
This answer would leave a few spaces as periods as the user entered. If you want it to fit your answer (which actually condenses multiple spaces into one), add an extra replacement:
myStr=myStr.replace(/\.+/g, ".");
source share