Jump to content

Need help with a 'Copy & Replace' textbox please :)


Recommended Posts

Hi guys,

In my work we have to send texts to people through emails. The format needs to be +447123456789@sms.com (as an example).

I have an HTML page with some helpful notes, links etc I keep open for quickness. What I want is to have a textbox on the page that I can type a standard mobile number into as '07123456789' and a copy button under it that will copy it as +447123456789@sms.com.

So it needs to replace the '0' with '+44' and add the '@sms.com' on the end.

I have seen it done before but can't figure out how. I know basic coding but I am better at tearing apart and rearranging to make it how I want than writing from scratch. Might be something really simple but I am just missing it!

Any help would be much appreciated! smile.gif

Thanks

Link to post
Share on other sites

Each language has its purpose. HTML give the page a structure, CSS give it appearance and Javascript is for behavior. HTML alone can't do anything to process form elements.

 

With Javascript it's very simple to do what you're asking.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...