Javascript: Remove / Delete a Select Option from List

To remove the Options from Select list, you need to assign NULL value to the option you want to delete. Or, you can use function remove() on select object.

Solution here are using simple JavaScript. After this, you will find solution using JQuery.

<script type="text/javascript">
function remSelOpt(inp1, sel1)
{
 len1 = sel1.options.length;
 for (i=0;i<len1 ;i++ )
 {
  if (sel1.options[i].value == inp1.value)
  {
   sel1.options[i] = null;
    //or
  //sel1.remove(i);
    break;
  }
 }
}
</script>
Enter a value in text box to remove an option from select list and focus-off from this (click anywhere other than text box):
<form >
<input type=text name="removeOption" onblur="remSelOpt(this, this.form.selectList)">
<select id="selectList" name="selectList">
 <option value="#">--</option>
 <option value="one" selected="selected">one</option>
 <option value="two">two</option>
 <option value="three">three</option>
</select>
<input type="submit" />
</form>

JQuery: For JQuery solution, use below jQuery function and call this function from input box:

<script>
function remSel(inp1)
{
 $("#selectList option[value='" + inp1.value + "']").remove();
}
</script>
<input type=text name="removeOption" onblur="remSel(this);return true;">
Using jQuery for just this work is not that good as you need to include jQuery file that is big.