Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

insertadjacenthtml trong js

1
2
3
4
5
6
7
8
9
10
11
12
13
let element = document.getElementById('node');
 
// Vị trí 1: beforebegin
element.insertAdjacentHTML("beforebegin", '<span>Nội dung chèn 1</span>');
 
// Vị trí 2: afterbegin
element.insertAdjacentHTML("afterbegin", '<span>Nội dung chèn 2</span>');
 
// Vị trí 3: beforeend
element.insertAdjacentHTML("beforeend", '<span>Nội dung chèn 3</span>');
 
// Vị trí 4: afterend 
element.insertAdjacentHTML("afterend", '<span>Nội dung chèn 4</span>');
Source by freetuts.net #
 
PREVIOUS NEXT
Tagged: #insertadjacenthtml #trong #js
ADD COMMENT
Topic
Name
1+8 =