Adding and remove items from a string without using arrays
<p>I am trying to add and remove things in a string with using arrays.  However this following script I created is not working as it doesn't remove numbers that have been submitted:</p>

<pre><code>function updateCCList(id)
{
     var MemberClicked = '[' + id + ']';
     var ListClickedMembers = document.frmSendMail.hidSenderList.value;
     if(ListClickedMembers.indexOf(MemberClicked) == -1)
     {
          ListClickedMembers += MemberClicked;
     }
     else
     {
          ListClickedMembers = ListClickedMembers.replace(/' + MemberClicked + '/g,'');
     }
     alert(ListClickedMembers);
     document.frmSendMail.hidSenderList.value += ListClickedMembers;
}
</code></pre>

<p>Any idea what is wrong?</p>

<p>Many thanks,
Paul</p>
