Been a while:
I am trying to use a jQuery function to change / or add data into an Input Field Form but I get the "Uncaught SyntaxError: Unexpected token ILLEGAL".
My Function:
<script type='text/javascript'>
jQuery(document).ready(function($) {
$(‘input#signup_username’).change(function () {
$(‘input#field_1′).val($(this).val());
});
})
</script>
I am trying to follow advice on a buddyPress Forum here to hide and change xProfile data on a BuddyPress registration form.
The suggestion:
On the registration form hide the xProfile name field (CSS display: none) and make a javascript listener (CHANGE) function to change the xProfile name field to the value of the WP username. This will take care of the form validation – xProfile name field is required. See reference…
Reference: jQuery(‘input#signup_username’).change(function () { jQuery(‘input#field_1′).val(jQuery(this).val()); });
No one has replied saying that it works or not but my fist obstacle is this token error.
So, any help with this would be greatly appreciated!
Those aren't normal single quotes. Try this:
jQuery(document).ready(function($) {
$('input#signup_username').change(function () {
$('input#field_1').val($(this).val());
});
})