Sarthak Sarthak - 1 year ago 76
HTML Question

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 "".
How can i achieve this by Javascript ?

Answer Source

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(""+$("#user").val()); //added google you can use facebook also

check below fiddle Url Fiddle Link

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download