Jeff, >> // remove selected items from the #mySelect element >> var oRemoved = $("option:selected", oSelect).remove(); >> >> -- or -- >> >> var oRemoved = oSelect.find("option:selected").remove(); >> > >How would you identify an individual option index using this syntax? >In other words if I wanted to check the value of the first option in >oSelect and if it is blank (""), then remove it? > >Is there a way to check to see if an option value is contained within >the select without looping (does jQuery have native functionality to >do this)?
There's nothing "built-in" to do that, but you can use the each() method to perform some logic on each match found: $("option:selected", oSelect).each( function (i){ // "this" is a reference to the DOM element, not jQuery object // "i" is the current array position // if the value attribute of the tag is empty, remove the item if( this.value.length == 0 ) $(this).remove(); } ); Now the above example would remove any value selected who's <option /> element's "value" attribute was empty. You need to build in additional checking to see if it was the first child of the parent <select /> element. -Dan