I am trying to set the selected attribute on a select pull down with jquery val(). I only have the caption (aka innerhtml) of the element I want the selected, but not the value.
For example:
A pulldown of states. I want the “New york” option to be selected. I want to write a jquery statement which does
$("#pull-down").val([get value of the option tag which has "New York" as its innerhtml])
Is this possible?
You can use
filtermethod.In case that
#pull-downis a select element and the option element that containsNew Yorkis child element of it, you can usepropmethod.