Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Selector based on sender
    primarykey
    data
    text
    <p>I have 4 <code>select</code> inputs with the same options. and I am trying to disable any option that has been selected from one of these selects. </p> <pre><code>&lt;select name="homeTeams[]" onchange="check()"&gt; &lt;option value="1"&gt;Team1&lt;/option&gt; &lt;option value="2"&gt;Team2&lt;/option&gt; &lt;option value="3"&gt;Team3&lt;/option&gt; &lt;option value="4"&gt;Team4&lt;/option&gt; &lt;/select&gt; &lt;select name="homeTeams[]" onchange="check()"&gt; &lt;option value="1"&gt;Team1&lt;/option&gt; &lt;option value="2"&gt;Team2&lt;/option&gt; &lt;option value="3"&gt;Team3&lt;/option&gt; &lt;option value="4"&gt;Team4&lt;/option&gt; &lt;/select&gt; &lt;select name="awayTeams[]" onchange="check()"&gt; &lt;option value="1"&gt;Team1&lt;/option&gt; &lt;option value="2"&gt;Team2&lt;/option&gt; &lt;option value="3"&gt;Team3&lt;/option&gt; &lt;option value="4"&gt;Team4&lt;/option&gt; &lt;/select&gt; &lt;select name="awayTeams[]" onchange="check()"&gt; &lt;option value="1"&gt;Team1&lt;/option&gt; &lt;option value="2"&gt;Team2&lt;/option&gt; &lt;option value="3"&gt;Team3&lt;/option&gt; &lt;option value="4"&gt;Team4&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I am trying to disable the option that has been selected from one of these selectors. I am using jQuery to do it, but I can't get the value based on the sender. </p> <p>Ex: if the user has chosen Team1 from Select 1 the <code>jQuery</code> code will disable the option Team1 from Select2 and Select3 and Select4. </p> <p></p> <pre><code> function check() { var a = $('select option:selected').val(); alert(a); } </code></pre> <p> </p> <p>it gives me the value of the first select. </p> <p>any Ideas ? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload