Where select_object holds the select tag element's reference.
Description of code :
To illustrate the use of remove() method we have created a simple HTML page into which we have created a dropdown list by using <select> tag and by default it consists of four items.
The function removeItem() takes the element object and then removes the element.selectedIndex item from the select tag option list. Here is the full example code for removeExampl.html as follows :
Click on the button "Remove" and it will remove the selected option from the <select> tag option list and if none is selected then by default first item will be removed. In our this example we don't have select any item therefore it removes first option which is "Vineet".
As soon as it removes item in the <select> list the button is disabled, this means remove operation have been performed successfully.