[jQuery] Stripping domain from email

[jQuery] Stripping domain from email


Situation: I've a username and password field, which I want to submit
to different systems depending on the submit button they choose. Now,
since I can't convince the programmers to edit their side of things,
that leaves me with 3 separate forms which have different input names.
I'm silently copying the username and password to the two form inputs
I'm hiding (leaving their submit buttons visible) using jQuery.
Because I want to eliminate errors as much as possible, I'm looking to
strip out things that people tend to do in their inputs just before I
submit (yes, once again because the programmers don't want to edit
*their* validation). When asked for their username, people tend to
enter their email address or some variation thereof. I'd like to
submit ONLY the first half of such an entry.
e.g.:
user@domain.com --> user
user@domain --> user
user.domain.com --> user
user.domain --> user
Here's the code I'm using to silently copy the input, and it's
probably just before this copy that the username stripping should
occur:
jQuery("#user_webmail").blur(
function(){

jQuery("#user_pay,#user_home").val(jQuery("#user_webmail").val()).focus().blur();
}
);
Any help would be appreciated.