Created
January 10, 2014 15:43
-
-
Save pmgllc/8356675 to your computer and use it in GitHub Desktop.
When do you run this on a page/form to split the name field before it posts to Infusionsoft?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
jQuery('#Submit').click(function() { | |
var splitName = jQuery('#Contact0FirstName').val(); | |
var names = splitName.split(' '); | |
var firstName = names.splice(0,1); | |
var lastName = names.join(' '); | |
jQuery('#Contact0FirstName').val(firstName); | |
jQuery('#Contact0LastName').val(lastName); | |
jQuery('form').submit(); | |
return true; | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
did you try to alter line 3 to:
jQuery('#Submit').click(function(e) {
and add right below that:
e.preventDefault();