0

OK. I see the duplicate link above.. I'll try above and see if that works for me. Thanks.

This should be something very simple, but I cannot find a way to do this.

If I have a "select" control something like this:

<select id="gate">
    <option value='Gateway 1'>Gateway A</option>
    <option value='Gateway 2'>Gateway B</option>
</select>

I can use the .val() function to programmatically select an item by value like this:

$("#gate").val('Gateway 1');

But if I want to use the text or the label to select an item, how do I do that? (i.e. I want to use the string "Gateway B" to select that option).

I've seen some stuff using "option", but haven't find a way to work.

As you can tell I'm a newbie to the UI stuff. On the side, one other question I have is that a code like below:

$("#gate").val('Gateway 1');

Is that standard JavaScript? JQuery? or HTML? Where can I find what sort of function I can call on $("#gate") object and what sort of options there are that I can pass and use?

KHP
  • 379
  • 1
  • 2
  • 10

0 Answers0