Home >>jQuery Tutorial >jQuery #id Selector

jQuery #id Selector

jQuery #id Selector

jQuery #id selector in jQuery is used to selects the element with the specific id and refers to the id attribute of an HTML element.

Syntax:
$("#id")

Parameter Values

Parameter Description
id It is a required parameter and used to specifies the id of the element to select
Here is an Example of jQuery #id Selector:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#start").css("background-color", "dodgerblue");
});
</script>
</head>
<body>
<h1>Welcome to Phptpoint</h1>
<p id="start">My name is phptpoint</p>
<p>I live in Noida</p>
</body>
</html>

Output:

Welcome to Phptpoint

My name is phptpoint

I live in Noida


No Sidebar ads