<!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>


14-2_Attr_addClass().html


반응형

+ Recent posts