Q:

HTML form text - save data as url using javascript

I am saving the form text(facebook page name) entered by the user into to database. 
<form:input type="text"  path="fName" value="${bean.fName}" title="Page Name"/> 

What i want is when the user enters the fbpage name in the form text it should automatically change into fb-url. For example if user enters "google" the form text should change to "https://www.facebook.com/google". 
How can i achieve this by Javascript ?

A:

Hello If I understand your problem that text should be change into url in the same textbox then try the below code 
$("#user").change(function()  //user is textbox ID
{
$("#user").val("https://www.google.com/"+$("#user").val()); //added google you can use facebook also
 });

check below fiddle
Url Fiddle Link

