AndrewC AndrewC - 4 years ago 153
Javascript Question

javascript/jquery remove or delete option from select

I need to delete an option from a select in certain circumstances.


if(mystatement == true)
//remove item with id 'option1' from select of id 'select1'

Anyone know the code for me to achieve this?

Many thanks.

Answer Source


Since id is unique in the document no need to relate it to the parent select element. You can do simply

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download