๋ฐ์ํ
label ํ๊ทธ
<label>
ํ๊ทธ ์์๋<div>
,<p>
ํ๊ทธ๊ฐ ๋ค์ด๊ฐ๋ฉด ์๋๋ค.
children() / find()
<h1>.children() ๋ฉ์๋</h1>
<div class="container">
<div>div(ํ ์๋ฒ์ง)
<ul class="child">ul(๋ถ๋ชจ)
<li>li(์์)
<span>span(์์1)</span>
<span>span(์์2)</span>
</li>
</ul>
</div>
</div>
<h1>.find() ๋ฉ์๋</h1>
<div class="container">
<div>div(ํ ์๋ฒ์ง)
<ul class="find">ul(๋ถ๋ชจ)
<li>li(์์)
<span>span(์์1)</span>
<span>span(์์2)</span>
</li>
</ul>
</div>
</div>
.container * {
display: block;
border: 1px solid lightgrey;
color: lightgrey;
padding: 5px; margin: 15px;
}
$(function() {
// 1. children()
$('ul.child').childern('*').css({border: '2px solid red'});
// 2. find()
$('ul.find').find('*').css({border: '2px solid blue'});
});
childern()
- li(์์)๋ง ๋ณํํ๋ค.
find()
- li(์์)๊ณผ span(์์1), span(์์2)์ด ๋ณํํ๋ค.
Reference
ํ์์์์ ํ์.children() .find()๋ฐ์ํ
'๐ฅ TIL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
2021.04.07 // width calc() ์ฃผ๊ธฐ (0) | 2021.04.07 |
---|---|
2021.04.05 (0) | 2021.04.05 |
2021.03.22 (0) | 2021.03.22 |
[CSS] ์์ฑ ์ ํ์ ์ ๋ฆฌ (0) | 2021.03.19 |
[CSS] ํ์ ์์๋ก ๊ฐฏ์ ์์๋ด๊ธฐ (0) | 2021.03.18 |