0

In a select, how I can select a particular option ?

For example, I want to select the option with 3 from this select ?

<select name="dropdown">
    <option disabled>10x10</option>
    <option disabled>20x20</option>
    <option disabled>30x30</option>
</select>

What I have tried:

$('select[name="dropdown"] option[text="20x20"]').attr('disabled', false);

Thanks.

popomomo
  • 71
  • 4
  • 1
    Note there is an answer for plain DOM (no jQuery) as well: https://stackoverflow.com/a/69042215/215552 – Heretic Monkey Jan 12 '23 at 04:27
  • 1
    That said, your attempt `$('select[name="dropdown"] option[text="20x20"]')` doesn't really match your question body ("I want to select the option with 3 from this select") – Heretic Monkey Jan 12 '23 at 04:29

0 Answers0