jQuery 추가() 메서드
예시
모든 <p> 요소 끝에 내용 삽입:
$("button").click(function(){
$("p").append("<b>Appended text</b>");
});
정의 및 사용
append() 메서드는 선택한 요소의 끝에 지정된 내용을 삽입합니다.
팁: 선택한 요소의 시작 부분에 내용을 삽입하려면 prepend() 메서드를 사용하십시오.
통사론
$(selector).append(content,function(index,html))
Parameter | Description |
---|---|
content | Required. Specifies the content to insert (can contain HTML tags)
Possible values:
|
function(index,html) | Optional. Specifies a function that returns the content to insert
|
직접 해보십시오 - 예
append() 메서드로 콘텐츠를 삽입합니다.
을 사용하여 선택한 요소의 끝에 내용을 삽입합니다.