title: Same function for different sections - relative referencing in jquery
body: <p>By using relative references I am able to remove items which have been added to the list within a specfic part of the form. For example, by adding a requirement it can be deleted just from the requirement. </p>
  
  <p><strong>My issue is two fold:</strong></p>
  
  <ol>
  <li>Adding an item to references adds it to all three categories</li>
  <li>When I try to add values to the other sections (qualifications) it says my input was blank.</li>
  </ol>
  
  <p><a href="http://jsfiddle.net/spadez/9sX6X/60/" rel="nofollow">http://jsfiddle.net/spadez/9sX6X/60/</a></p>
  
  <pre><code>var container = $('.copies'),
      value_src = $('#current'),
      maxFields = 10,
      currentFields = 1;
  
  $('.form').on('click', '.add', function () {
        value_src.focus();
      if ($.trim(value_src.val()) != '') {
          if (currentFields &lt; maxFields) {
              var value = value_src.val();
              var html = '&lt;div class="line"&gt;' +
                  '&lt;input id="accepted" type="text" value="' + value + '" /&gt;' +
                  '&lt;input type="button" value="X" class="remove" /&gt;' +
                  '&lt;/div&gt;';
  
              $(html).appendTo(container);
              value_src.val('');
              currentFields++;
          } else {
              alert("You tried to add a field when there are already " + maxFields);
          }
      } else {
          alert("You didn't enter anything");
      }
  
  })
      .on('click', '.remove', function () {
          value_src.focus();
      $(this).parents('.line').remove();
      currentFields--;
  });
  </code></pre>
  
  <p>Is it possible to modify this code without repeating it for each section, by using relatively references such as "parent" for example. I want to use this same script for all three sections but have it so each list is independant.</p>
  
  <p>I'm new to javascript so I was wondering if this is possible because I only managed to get it working on the delete.</p>