freeCodeCamp/guide/russian/certifications/front-end-libraries/jquery/target-the-parent-of-an-ele.../index.md

16 lines
497 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Target the Parent of an Element Using jQuery
localeTitle: Задайте родительский элемент элемента с помощью jQuery
---
## Задайте родительский элемент элемента с помощью jQuery
## Решение
```js
<script>
$(document).ready(function() {
$("#target1").parent().css("background-color", "red"); // Selects the parent of #target1 and changes its background-color to red
});
</script>
```