user2999509
user2999509

Reputation: 107

Chrome console script to select options in a drop down menu

I have a page with a lot of food items there are a few options for me to select for each food item. I want to sequentially select Order for everything on the menu. Is there a script to make this happen? Thanks!

<select class="form-control" onchange="setFlag(999$(this).val(),$('option:selected', this).html());">                                                                               </select>
    <option value="Order"> Make this order </option>
    <option value="Veto"> Veto this order </option>

Upvotes: 0

Views: 6195

Answers (2)

QuinnF
QuinnF

Reputation: 2169

I would take a look at this answer https://stackoverflow.com/a/6068322/1115876

something like

$('[value="Order"]').prop('selected', true)

should work

Upvotes: 0

Shivam Tiwari
Shivam Tiwari

Reputation: 355

HTML

<select id="sel">
<option value="Order"> Make this order </option>
<option value="Veto"> Veto this order </option>
  </select>

JS

document.querySelector("#sel").value = "Veto" // selects 2nd option from dropdown

Upvotes: 2

Related Questions