add

English [æd] US [æd]

vt.Add; 추가 설명 포함... 추가 작업(보고서의 보충 부분)

English [klɑ :s] US [klæs]

n.class; 유형

vt....를 특정 수준으로 처리(또는 분류, 범주화); class

adj. 아주 좋음, 훌륭함, 탁월함

vi.... 카테고리(또는 레벨)에 속함, 특정 카테고리(또는 특정 레벨)로 나열됨

jquery addClass() 메서드 통사론

기능: addClass() 메서드는 선택한 요소에 하나 이상의 클래스를 추가합니다. 이 방법은 기존 클래스 속성을 제거하지 않고 하나 이상의 클래스 속성만 추가합니다. 여러 클래스를 추가해야 하는 경우 클래스 이름을 공백으로 구분하세요.

구문: ​​$(selector).addClass(클래스)

매개변수:

ParametersDescription
class 필수입니다. 하나 이상의 클래스 이름을 지정합니다.

구문: ​​$(selector).addClass(function(index,oldclass))

매개변수:

ParametersDescription
함수(인덱스,oldclass) 필수입니다. 추가할 하나 이상의 클래스 이름을 반환하는 함수를 지정합니다.
index 선택사항. 선택기의 인덱스 위치입니다.
수업선택사항. 선택기의 이전 클래스 이름입니다.

jquery addClass() 메서드 예

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("p:first").addClass("intro");
  });
});
</script>
<style type="text/css">
.intro
{
font-size:120%;
color:red;
}
</style>
</head>

<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>向第一个 p 元素添加一个类</button>
</body>
</html>
인스턴스 실행 »

온라인 인스턴스를 보려면 "인스턴스 실행" 버튼을 클릭하세요