How to select multiple elements using jQuery ? Last Updated : 16 May, 2023 Comments Improve Suggest changes Like Article Like Report In this article, we will learn how to select multiple elements using JQuery. JQuery is the fastest and most lightweight JavaScript library that is used to simplify the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. JQuery is widely famous for its motto of “Write less, do more.” It simply means that you can achieve your goal by just writing a few lines of code. Approach: We can select as many classes as we want using '$' to select classes. If you wish you can specify any number of selectors to combine into a single result. This multiple-expression combinator is an efficient way to select dissimilar elements and the order of the DOM elements in the returned jQuery object may not be identical, as they will be in document order. Syntax: $( "classOne, classTwo, classThree" ) .css( "property name", "value" ); Example: In this example, we are using the above-explained approach. HTML <!doctype html> <html lang="en"> <head> <style> div, span, p { width: 126px; height: 60px; float: left; padding: 3px; margin: 2px; background-color: #eee; font-size: 14px; } body { text-align: center; } </style> <script src= "https://code.jquery.com/jquery-3.5.0.js"> </script> </head> <body> <h1 style="color:green"> GeeksForGeeks </h1> <div>Linux</div> <p class="myClass"> Windows </p> <p class="notMyClass"> Pizza </p> <span>MacOS</span> <script> $("div, span, p.myClass") .css("border", "5px solid green"); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to select multiple elements using jQuery ? V volumezero9786 Follow Improve Article Tags : Web Technologies JQuery CSS-Properties HTML-Questions CSS-Questions jQuery-Questions +2 More Similar Reads jQuery multiple elements Selector The jQuery multiple elements Selector is used to select multiple elements of an HTML document. Syntax: $("element1, element2, element3, ...")Parameter: element: This parameter is required to specify the elements to be selected.Example 1: In this example, we will select the multiple elements by using 1 min read How to select an element by name with jQuery ? Selecting an element by name with jQuery allows you to target HTML elements using their `name` attribute. This method is commonly used in form handling, where input fields, checkboxes, or radio buttons share the same name, enabling you to easily manipulate or retrieve their values.Table of ContentUs 3 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 make Basic selects using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be making Basic selects using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel="stylesheet" h 1 min read How to use jQuery UI MultiSelect Widget ? In this article, we will learn to use jQuery UI MultiSelect Widget for our web pages. Please download the required pre-compiled files before implementing the following example codes from the official website. Take care of the file paths in your project folder. Example 1: The following example demons 3 min read Like