I have a question very similar to this but I can't seem to get it to work.
I have a input like this:
<input id="authorities" name="authorities" type="text">
And a hidden input like this:
<input id="team_authority_emails" name="team[authority_emails]" type="hidden" value="{asvxcvxcvva@gmail.com,test@test.com.au}">
jQuery:
$('#authorities').bind("keyup", function() {
var val = $(this).val();
$('#team_authority_emails').val(val);
});
What I'm trying to achieve is passing the input value from authorities
to team_authority_emails
in the correct format while retaining the present values. E.g. If I added a new email tesdadf@adfs.com the value in my hidden field would become value="{asvxcvxcvva@gmail.com,test@test.com.au,tesdadf@adfs.com}"
.