jQuery element + next Selector Last Updated : 14 Nov, 2022 Comments Improve Suggest changes Like Article Like Report The ("element + next") selector selects in jQuery used to select the just "next" element of the specified "element". This selector only works when the "next" element is placed just after the specified element. For Example: If the statement is $("div + p") then this will only select the first "p" element which is just next to "div" and the other "p" element are ignored. But if the statement is $("div + p") and a "h1" is placed in between the selected "div" and "p" element then this selector will not work and "p" element will remain noneffective.Syntax: $("element + next")Parameter: Here, parameter are required and this will specifies any valid elements. Return Value: This will return the selected element with the specified change. Example 1: Here the paragraph element is just next to the div element. HTML <!DOCTYPE html> <html> <head> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script> $(document).ready(function () { $("div + p").css("background-color", "lightgreen"); }); </script> <style> body { width: 80%; height: 40%; padding: 10px; border: 2px solid green; font-size: 20px; } div { border: 1px solid green; padding: 10px; } </style> </head> <body> <div>Welcome to GfG.!</div> <p>This is first paragraph element.</p> <p>This is second paragraph element.</p> </body> </html> Output: Example 2: Here, heading element is in between the paragraph and the div element. So no change will take place to the "p" element. HTML <!DOCTYPE html> <html> <head> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script> $(document).ready(function () { $("button").click(function () { $("div + p").css("background-color", "lightgreen"); }); }); </script> <style> body { width: 80%; height: 40%; padding: 10px; border: 2px solid green; font-size: 20px; } div { border: 1px solid green; padding: 10px; } </style> </head> <body> <div>Welcome to GfG.!</div> <h1>Heading element ios here.</h1> <p>This is first paragraph element.</p> <p>This is second paragraph element.</p> <button>Submit</button> </body> </html> Output: Before Click: After Click: Comment More infoAdvertise with us S Sruti Rai Follow Improve Article Tags : Web Technologies JQuery jQuery-Selectors Similar Reads jQuery * Selector The jQuery * selector selects all the elements in the document, including HTML, body, and head. If the * selector is used together with another element then it selects all child elements within the element used. Syntax: $("*")Parameters: *: This parameter is used to select all elements.Example 1: Se 1 min read jQuery #id Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating on the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Aja 1 min read jQuery .class Selector The jQuery .class selector specifies the class for an element to be selected. It should not begin with a number. It gives styling to several HTML elements. Syntax: $(".class") Parameter: class: This parameter is required to specify the class of the elements to be selected.Example 1: In this example, 1 min read jQuery multiple classes Selector The jQuery multiple class selector is used to select multiple classes of an HTML document. Syntax: $(".class1, .class2, .class3, ...")Parameter: class: This parameter is required to specify the class of the elements to be selected.Example 1: In this example, we will select the multiple classes by us 1 min read jQuery element Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax i 1 min read 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 jQuery :first Selector The jQuery :first Selector is used to select the first element of the specified type. Syntax: $(":first")Example 1: In this example, we will select the first <p> element by using jQuery :first Selector. HTML <!DOCTYPE html> <html> <head> <script src= "https://ajax.goo 1 min read jQuery :last Selector The jQuery :last Selector is used to select the last element of the specified type. Syntax: $(":last")Example 1: In this example, we will select the last <p> element by using jQuery :last Selector. HTML <!DOCTYPE html> <html> <head> <script src= "https://ajax.googleap 1 min read jQuery :even Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating on the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Aja 2 min read jQuery :odd Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax i 2 min read Like