# How to locate elements in DOM with jQuery.find()

jQuery.find() means you can search for specific **HTML tags, classes, or IDs** without having to do time-consuming manual searches.

## What is the jQuery.find() method?

By applying jQuery.find() to a specific jQuery object, you can locate elements within that object. **The search is recursive**. This means that not only the direct children of jQuery.find(parent) are searched, but also all nested elements in the DOM tree. The result is a new jQuery object that contains all the elements found with jQuery.find(). This can then be manipulated or used as a basis for further operations. For example, you can add a class to the object using [jQuery.addClass()](https://www.ionos.com/digitalguide/websites/web-development/jquery-addclass/) or append other elements using [jQuery.append()](https://www.ionos.com/digitalguide/websites/web-development/jquery-append/). Furthermore, [jQuery in WordPress](https://www.ionos.com/digitalguide/hosting/blogs/wordpress-jquery/) allows you to easily find objects in your CMS.

Tip With [Webspace](https://www.ionos.com/hosting/webspace "Rent webspace from IONOS") from IONOS you get over 50 GB for your web projects as well as a free SSL wildcard certificate. The cheapest rate starts at only $4 per month. Moreover, you have the possibility to extend your hosting plan at any time. If you have questions or problems, the IONOS expert support is available to you around the clock.

## What does the syntax for jQuery.find() look like?

The jQuery.find() method has the following structure:

```jQuery
$(selector).find(filter)
```

- **filter**: is optional and is used to further filter the found elements using additional [selectors in jQuery](https://www.ionos.com/digitalguide/websites/web-development/jquery-selectors/), for example jQuery.find(class) or jQuery.find(id)

If you want to learn more about selectors, their notations and functions, you can take a look at our [jQuery tutorial](https://www.ionos.com/digitalguide/websites/web-development/jquery-tutorial-introduction-and-first-steps/).

Tip The [IONOS API](https://developer.hosting.ionos.com "IONOS Developer API") opens up the possibility to handle tasks and processes in an automated way. This allows you to create and configure resources without relying on manual intervention. The autonomous approach not only saves you time, but also reduces potential errors.

## Examples for using jQuery.find()

We will demonstrate the variety of selectors you can use as **filters** for the jQuery.find() method with the following examples:

```jQuery
// Search for all <a>-elements within a <div>-element in the "container" class
$('.container').find('a');
// Search for <li>-elements within a <ul>-element with the ID "myList"
$('#myList').find('li');
// Search for all <input>-elements within a <form>-element and filter for the "text" type
$('form').find('input[type="text"]');
```

You can also connect **additional functions** easily using jQuery.find():

```jQuery
$("div#container").find("button").addClass("selected");
```

Using jQuery.find(element) in this example, we locate all the buttons in the &lt;div&gt; element with the ID “container” and assign them the class “selected”.

Tip Want to get your own website or app online quickly? [Deploy Now](https://www.ionos.com/hosting/deploy-now "Automatic Deployments from IONOS") from IONOS guarantees you easy staging including preview URL. With the easy-to-use interface and automatic framework detection, you can set up your application quickly and easily.


This is a markdown version of: [https://www.ionos.com/digitalguide/websites/web-development/jquery-find/](https://www.ionos.com/digitalguide/websites/web-development/jquery-find/) for AI/LLM consumption.