Something like this should work: str = $(textinput).val(); $(textinput).val( str.substr(0,str.indexOf("@")) );
On Jan 23, 7:51 pm, whtthehecker <hecker.r...@gmail.com> wrote: > Hi, > > I'm trying to create a sign up form where after the user inputs their > email address when they click or tab down to the next field (username > field) it auto-populates it with their email address but with the > "@xxxxx.xxx" section stripped from it. i.e. if the user puts > "j...@johndoe.com" into the email field when they tab to the username > field it will auto-populate with "john". > > I have achieved auto-populating the field with the email address but > I'm not sure how to remove the "@johndoe.com" part. > > Thanks for any help you can provide!