• 회원가입
  • 로그인
  • 구글아이디로 로그인

[DOM_Element] JS - insertAdjacentText() 메서드 - 텍스트문자열을 지정위치에 삽입

insertAdjacentText() 예제 - afterend 경우

 

<h2 id="hz">홈짱닷컴 Homzzang.com</h2>

<p>HTML CSS JS JQ PHP SQL BS</p>

<button onclick="homzzang()">클릭</button>


<script>

function homzzang() {

  var h = document.getElementById("hz");

  h.insertAdjacentText("afterend", "홈페이지 제작관리");

}

</script>

 

결과보기

 

insertAdjacentText() 정의

 

HTML 문자열을 지정위치에 삽입 (IE4 이상)

 

 

 

insertAdjacentText() 구문

 

node.insertAdjacentText(position, text)

 


 

[매개변수]

 

position

필수. 요소(node)에 대한 상대적 위치를 표시하는 문자열.

 

afterbegin : 요소 시작 후 (= 첫 번째 자식으로)

afterend : 요소 뒤

beforebegin : 요소 앞

beforeend : 요소 끝 이전 (= 마지막 자식으로)

 

text

필수. 삽입할 텍스트 문자열

 



분류 제목
DOM_Element JS - accessKey 속성 - 요소접근키 (= accessKey속성 = 액세스키속성) ※ 요소접근단축키
DOM_Element JS - addEventListener() 메서드 ★ - 요소에 이벤트 걸기. (addEventListene…
DOM_Element JS - appendChild() 메서드 - 요소에 마지막 자식요소생성 (= 마지막 자식요소추가 = appe…
DOM_Element JS - attributes 속성 - 요소의 속성들 (= 요소속성모음 = attributes속성 = 어트리뷰…
DOM_Element JS - blur() 메서드 - 포커스 제거. (= blur메서드 = 블러 메서드) ※ 링크 클릭 잔상 제…
DOM_Element JS - childElementCount 속성 - 자식요소개수 (IE9 이상)
DOM_Element JS - childNodes 속성 - 자식노드리스트
DOM_Element JS - children 속성 ★ - 자식요소노드 (IE9 이상)
DOM_Element JS - classList 속성 ★★ - 요소의 클래스리스트. (= classList속성 = 클리스리스트속성…
DOM_Element JS - className 속성 ★★★ = 요소의 클래스명 반환/설정. (= className속성 = 클래스…
DOM_Element JS - click() 메서드 ★★★★★ - 마우스클릭간주 (= 클릭이벤트 = click메서드 = 클릭메서드…
DOM_Element JS - clientHeight 속성 - 요소높이 (= 요소가시높이) (padding 포함 / border,…
DOM_Element JS - clientLeft 속성 - 요소왼쪽테두리너비 (= 요소좌측테두리너비)
DOM_Element JS - clientTop 속성 - 요소위쪽테두리너비 (= 요소상단테두리너비)
DOM_Element JS - clientWidth 속성 ★ - 요소너비 (= 요소가시너비 = clientWidth속성 = 클라이…
DOM_Element JS - cloneNode() 메서드 - 노드복사
DOM_Element JS - compareDocumentPosition() 메서드 - 노드간 위치비교 (IE9 이상)
DOM_Element JS - contains() 메서드 ★ - 자손노드인지 판별 (= contains메서드 = 컨테인즈 메서드)
DOM_Element JS - contentEditable 속성 - 편집가능상태 설정/반환
DOM_Element JS - dir 속성 - 쓰기방향 (= 입력방향) 설정/반환
27/67
목록
찾아주셔서 감사합니다. Since 2012