---
title: "Finding first div id in DOM"  
description: "Finding first div id in DOM"  
author: "Anonymous User"  
published: 2018-05-08  
updated: 2018-05-08  
canonical: https://www.mindstick.com/forum/34481/finding-first-div-id-in-dom  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# Finding first div id in DOM

I want to [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) first div. How to do this.

```
<div style="border: 1px solid black;">
  <p>first paragraph</p>
</div>
<br>
<div style="border: 1px solid black;">
  <p>second paragraph</p>
</div>
```

please [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) helpme

## Replies

### Reply by Anonymous User

You can use first function in jquery

```
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("div").first().css("background-color", "yellow");
});
</script>
</head>
```


---

Original Source: https://www.mindstick.com/forum/34481/finding-first-div-id-in-dom

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
