jQuery #id Selector Last Updated : 11 Jul, 2025 Suggest changes Share 7 Likes Like Report 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, Ajax interactions, and cross-browser JavaScript development. The #id selector specifies an id for an element to be selected. It should not begin with a number and the id attribute must be unique within a document which means it can be used only one time. Syntax: $("#id")Parameter: id: An element's specific id.Example 1: 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 () { $("#Geeks").css("background-color", "red"); }); </script> </head> <body> <h1>GEEKS FOR GEEKS</h1> <p id="Geeks">jQuery|#id selector</p> </body> </html> Output: Example 2: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ID</title> <style> div { width: 100px; height: 100px; float: left; padding: 10px; margin: 10px; background-color: pink; } </style> <script src= "https://code.jquery.com/jquery-1.10.2.js"> </script> </head> <body> <div id="DIV1"> <p>id="DIV1"</p> </div> <div id="DIV2">id="DIV2"</div> <script> $("#DIV2").css("border", "2px solid yellow"); </script> </body> </html> Output: Supported Browsers: Google ChromeMozilla FirefoxEdgeSafariOpera Create Quiz K kartikgoel1999 Follow 7 Article Tags : Web Technologies JQuery jQuery-Selectors Explore jQuery Tutorial 7 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like