I want to set the 'selected' attribute in a select option list with javascript/jquery. I have the select element in a jquery object, I just want to add the "selected" attribute to and item in the list.
$(mySelect).html() looks like this;
<option value="LININGER LAKE">LININGER LAKE</option>
<option value="MOOREDALE LAKE">MOOREDALE LAKE</option>
<option value="CARTER LAKE">CARTER LAKE</option>
I need to find the "CARTER LAKE" option and add the selected attribute to it so the HTML looks like this
<option value="LININGER LAKE">LININGER LAKE</option>
<option value="MOOREDALE LAKE">MOOREDALE LAKE</option>
<option value="CARTER LAKE" selected="selected">CARTER LAKE</option>
I know this can't be that hard, I'm just having a brain fart!
selectedIndexorvalueof the containing<select>element?mySelect?$(yourSelectSelector).val('CARTER LAKE')?