Search code examples
javascriptprototypejsdollar-sign

Getting all selects with the same selected value in Prototype $$()?


How get all select with the same "selected value" in Prototype $$()?

Example: all select with "5" select value

<select name="first">
  <option value="">-- Selecione --</option>
  <option value="4">Auxiliar de vistoria</option>
  <option selected="selected" value="5">Examinador</option>
</select>

<select name="second">
  <option value="">-- Selecione --</option>
  <option selected="selected" value="4">Auxiliar de vistoria</option>
  <option value="5">Examinador</option>
</select>

Thanks, Celso


Solution

  • Try:

    $$('select:has(option:selected[value=5])')
    

    Fiddle: http://jsfiddle.net/doktormolle/a5t4a/