By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,964 Members | 1,973 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,964 IT Pros & Developers. It's quick & easy.

Replaceing ampersands

P: 1

I'm new to javascript and need a hand.

I have a form with an input field and text area, that I need to replace any input '&' with the word 'and'.

How would I accomplish this with an "onblur" event.

Thank you
Nov 19 '08 #1
Share this Question
Share on Google+
1 Reply

P: 428
element={value:'Lewis & Clark & John & James'};

element.value=element.value.replace(/ *& */g,' and ');
Nov 19 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.