How to select first element in the drop-down list using jQuery ? Last Updated : 06 Jun, 2023 Comments Improve Suggest changes Like Article Like Report Given a drop-down list containing options elements, the task is to get the first element of the select element using JQuery. Approach 1: Select the first element of <select> element using the jQuery selector.Use the prop() method to get access to properties of that particular element.Change the selectedIndex property to 0 to get access to the first element (Index starts with 0). Example: This example implements the above approach. html <!DOCTYPE html> <html lang="en"> <head> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <title> How to select first element in the drop-down list using jQuery ? </title> <style> body { text-align: center; } select { width: 160px; height: 30px; } </style> </head> <body> <h1 style="color:green;"> GeeksforGeeks </h1> <p> Click on the button to get the first option's value using JQuery </p> <select id="select"> <option value="GFG1">GFG1</option> <option value="GFG2">GFG2</option> <option value="GFG3">GFG3</option> <option value="GFG4">GFG4</option> <option value="GFG5">GFG5</option> </select> <br><br> <button onclick="gfg_Run()"> Click here </button> <p id="GFG"></p> <script> let el = document.getElementById("GFG"); function gfg_Run() { el.innerHTML = $("#select").prop("selectedIndex", 0).val(); } </script> </body> </html> Output: Approach 2: Select the <select> element using the jQuery selector.This selector is more specific and selects the first element using the option:nth-child(1).This will get access to the first element (Index starts with 1). Example: This example implements the above approach. html <!DOCTYPE html> <html lang="en"> <head> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <title> How to select first element in the drop-down list using jQuery ? </title> <style> body { text-align: center; } select { width: 160px; height: 30px; } </style> </head> <body> <h1 style="color:green;"> GeeksforGeeks </h1> <p> Click on the button to get the first option's value using jQuery </p> <select id="select"> <option value="GFG1">GFG1</option> <option value="GFG2">GFG2</option> <option value="GFG3">GFG3</option> <option value="GFG4">GFG4</option> <option value="GFG5">GFG5</option> </select> <br><br> <button onclick="gfg_Run()"> Click here </button> <p id="GFG"></p> <script> let el = document.getElementById("GFG"); function gfg_Run() { el.innerHTML = $('#select option:nth-child(1)').val(); } </script> </body> </html> Output: jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, It is widely famous for its philosophy of “Write less, do more". You can learn jQuery from the ground up by following this jQuery Tutorial and jQuery Examples. Comment More infoAdvertise with us Next Article How to select first element in the drop-down list using jQuery ? P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JQuery Web technologies jQuery-Questions jQuery +2 More Similar Reads How to get selected text from a drop-down list using jQuery? In this article, we will learn how we can get the text of the selected option in a select tag using jQuery. There are two ways in jQuery that we can use to accomplish this task. Table of Content Using the val() method By using option:selected selector and text() method togehterUsing the val() method 2 min read How to filter the children of any element using jQuery ? In this article we will learn how to filter the children of any element in JQuery. JQuery is a fast and lightweight JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. It is widely famous for its motto o 3 min read How to change Selected Value of a Drop-Down List using jQuery? We will change the default selected value of the dropdown using jQuery. In an HTML select tag, the default selected value is the value given to the first option tag. With jQuery, it is easy to change the selected value from a drop-down list. Below are the methods to change the selected value of a dr 3 min read How to display div elements using Dropdown Menu in jQuery? In order to display data/content of a specific element by selecting the particular dropdown menu in jQuery, we can use the with following ways: Using hide() and show() methods: hide() methods : This method is used to hiding the syntax or the element of html that you want to hide. Syntax: $(selector) 4 min read How to get selected option from Dropdown in jQuery ? In this article, we learn how to get the selected option from the dropdown list. This article requires some familiarity with HTML, CSS, JavaScript, and jQuery. We can solve this challenge by using the jQuery val() method. The val() method in jQuery is used to set or return the value of an attribute 2 min read How to select direct parent element of an element in jQuery ? In this article, we will select the direct parent element of an element using jQuery. To select the direct parent element, the parent() method is used. This method finds the parent element related to the selected element. This parent() method traverses a single level up the selected element and retu 1 min read How to select/deselect multiple options in dropdown using jQuery ? To select and deselect multiple options in a drop-down menu, we will use the HTML and CSS codes. HTML code helps to define the basic structure of the webpage and CSS will benefit in designing the web page. Some essential properties used in the code are as follows- <div> - This is a division ta 4 min read How to select element by ID in jQuery ? In this article, we are going to see how to select the element by its id using jQuery. To learn about this topic one should have prior knowledge about HTML, CSS, JavaScript and jQuery. Using JavaScript: This question is also solved by a popular JavaScript method called document.getElementById() whic 2 min read How to find element with specific ID using jQuery ? The question is to determine whether an element with a specific id exists or not using JQuery. jQuery on() Method: This method adds one or more event handlers for the selected elements and child elements.Syntax: $(selector).on(event, childSelector, data, function, map)Parameters: event: It is requir 3 min read How to select elements by attribute in jQuery ? jQuery is a lightweight JavaScript library. In the vanilla JavaScript language, the getElementById method is used to select an element. However, jQuery provides a much lighter alternative for the same purpose. The 'jQuery Selector' allows the user to manipulate HTML elements and the data inside it(D 2 min read Like