mardi 4 août 2015

Two HTML selects with differing selected values

I got following HTML code:

<select id="first">
  <option value="0" selected="selected"> default </option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

<select id="second">
  <option value="0" selected="selected"> default </option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

So both of them have same data. I need to secure, that user can't select same value in both of them.

I hoped, that JQuery has some nice feature like:

$("#first").getOptions()

or even

$("#first").setOptions()

but unfortunately, it doesn't. This makes it very complicated for me, because I don't know JQuery very well ...

So, what is the best approach to solve my problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire