Javascript regexp help needed
March 22, 2006 11:30 AM
Subscribe
Using javascript, what would be the most efficient way to reduce a multi-word string down to just the first word?
The site takes a "first name/mi/last name" submission all in one field, rather than separate fields for each. I want to grab just the first name out of the submitted field. I realize the best solution would be to change the form to separate the fields but that's not an option at the moment.
posted by mr_crash_davis to computers & internet (10 comments total)
firstname = fullname.split(" ")[0];
posted by mbrubeck at 11:44 AM on March 22, 2006