title: How to check if same option is selected in a dynamically created form rows
body: <p>Been trying for hours but cannot get it right how can i check if an option is already selected in another select. Where am creating my form rows dynamically with the same class for all the newly created select.</p>
  
  <p>below is how my form is after being created dynamically.</p>
  
  <pre><code>&lt;select class="tank_id" name="Form[tank_id][]"&gt;
    &lt;option value=""&gt;Select&lt;/option&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;select class="tank_id" name="Form[tank_id][]"&gt;
    &lt;option value=""&gt;Select&lt;/option&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;select class="tank_id" name="Form[tank_id][]"&gt;
    &lt;option value=""&gt;Select&lt;/option&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>what i want to achieve is to make sure the data submitted does not have duplicates. My issue is to find out if an option is already selected in a previous select below is the js i have tried but haven't achieved anything with it.</p>
  
  <pre><code>        $(".tank_id").on('change', function(){
  
              var inputs = $('.tank_id');
  
              var result = inputs.filter(function(i,el){
                  return inputs.not(this).filter(function() {
                      return this.value === el.value;
                  });
              });
  
              if (result.length &gt; 0) {
                  alert('match found')
              }
  
          }); 
  </code></pre>