<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src ="http://code.jquery.com/jquery-latest.js"></script>
<title>.addClass()</title>
<style>
p
{
margin: 8px;
font-size: 16px;
}
.selected
{
border: 1px solid black;
}
</style>
</head>
<body>
<p>Hello</p>
<p>AND</p>
<p>Goodbye</p>
<script>
//<p>엘리먼트들중 마지막것에 "selected"속성을 추가함.
$("p:last").addClass("selected");
</script>
</body>
</html>
반응형
'Programming > JavaScript' 카테고리의 다른 글
[JavaScript] 14-2_Attr_hasCalss().html (0) | 2016.12.12 |
---|---|
[JavaScript] 14-2_Attr_attr()_html().html (0) | 2016.12.12 |
[Javascript] 12-3_XMLHttpRequestStatus.js (0) | 2016.12.09 |
[JavaScript] 12-2_getResult.jsp (0) | 2016.12.09 |
[javaScript] 12-2_getResult.js (0) | 2016.12.09 |