File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1+ // innerHTML
2+
3+ const theContainer = document . querySelector ( '.container' ) ;
4+
5+ const NewElement = document . createElement ( 'p' ) ;
6+ NewElement . innerText = 'Lorem ipsum' ;
7+ theContainer . appendChild ( NewElement ) ;
8+
9+ // u can change text use innerHTML with tag html
10+ NewElement . innerHTML = `<ul>
11+ <li>SHP</li>
12+ <li>RHP</li>
13+ <li>Marine Ford</li>
14+ </ul>` ;
15+
16+ // but if use textContent not work
17+ // if use syntax HTML and will display syntax html
18+ // NewElement.textContent = `<ul>
19+ // <li>SHP</li>
20+ // <li>RHP</li>
21+ // <li>Marine Ford</li>
22+ // </ul>`;
Original file line number Diff line number Diff line change @@ -130,10 +130,20 @@ <h2 class="shp">The Pirates of SHP</h2>
130130 <h2 class="shp">The Pirates of SHP</h2>
131131 </div> -->
132132
133- <!-- remove , removeChild -->
133+ <!-- remove , removeChild
134134 <h2>Hello World</h2>
135135 <div class="container">
136136 <h2>On container</h2>
137+ </div> -->
138+
139+ <!-- innerHTML & textContent
140+ <div class="container">
141+ <h1>Hello World</h1>
142+ </div> -->
143+
144+ < div class ="container ">
145+ < h3 > The Pirates</ h3 >
146+ < button class ="btn "> Join</ button >
137147 </ div >
138148 <!-- source js -->
139149 <!-- <script src="/01_getElementById.js"></script> -->
@@ -150,6 +160,8 @@ <h2>On container</h2>
150160 <!-- <script src="/12_createElement_textnode_appendChild.js"></script> -->
151161 <!-- <script src="/13_insertBefore.js"></script> -->
152162 <!-- <script src="/14_innerText_prepend.js"></script> -->
153- < script src ="/15_remove_removeChild.js "> </ script >
163+ <!-- <script src="/15_remove_removeChild.js"></script> -->
164+ <!-- <script src="/16_innerHTML_textContent.js"></script> -->
165+ < script src ="/17.addEventListener.js "> </ script >
154166 </ body >
155167</ html >
You can’t perform that action at this time.
0 commit comments