Summary: in this tutorial, you will learn how to handle the . The elements in the collection are sorted as they appear in the source code: More Examples. This allows the user to get the value he selected from the dropdown list. Introduction to the HTML select elements A 'obj' c'est objet récupérer dans onclick . In this post, we will see how to remove all options from a drop-down list with JavaScript and jQuery. The element. Exemple complet d'utilisation . You can either remove all the options or remove just a single one, as well as, you can add multiple options or remove all them and add new options. That function is listed below, and is fast enough when there are not that many options in the drop-down list (a.k.a. How to show all the options from a dropdown list with JavaScript? 0. 1075. So the value of the selected option can be obtained in JavaScript as follows: var sel = document.getElementById('scripts'); console.log( sel.value ); If option elements do not contain a value attribute, generally the text content of the option element will be the value property.