title: jquery and modifying two hidden input fields
body: <p>I have a table where I display some information for a user to "approve" or "deny" certain projects. I created two images: a cross sign for denials, and a check sign for approvals. On each click, I am adding the unique id to its respective hidden form field (rejectedProjs and approvedProjs). In addition, if a user clicked on "deny" then I am displaying a text box so that they can enter a reason. This is what I have so far: </p>
  
  <pre><code> $("a[name^=reject-]").each(function() {
  
       var name = $(this).attr('name');    
       var p_project_number = name.split('-')[1]; 
     $("a[name=reject-"+p_project_number+"]").tipbox("Reject pricing for "+p_project_number, 0, "reject-"+p_project_number);
       $(this).click(function() { 
  $("textarea[name=rejReason-"+p_project_number+"]").show();   
  rP = $("#rejectedProjs").val();
  $("#rejectedProjs").val(rP+','+p_project_number);
  alert('rejects: '+$("#rejectedProjs").val());
       });   
   });
  </code></pre>
  
  <p>There are two problems. First, if I click on the deny button twice for the same project, the alert box will display the project number twice. How can I check the $("#rejectedProjs").val() to see if that project number is already there? Second, if say I deny first and then approve, I need to remove that project from $("#rejectedProjs").val(). Not sure how to do this. thanks in advance.</p>