8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b88af94 commit 2b655b5Copy full SHA for 2b655b5
23_example.js
@@ -0,0 +1,21 @@
1
+const container = document.querySelector('.container');
2
+const btn = document.querySelector('.btn');
3
+
4
+function addElement(e) {
5
+ // create element h1
6
+ const heading_1 = document.createElement('h1');
7
+ // add class with the name heading
8
+ heading_1.classList.add('heading');
9
+ // create Text content
10
+ heading_1.textContent = 'The pirates of SHP';
11
+ // show to browser pages
12
+ container.appendChild(heading_1);
13
+}
14
15
+// here if heading release and click get text hello there
16
+container.addEventListener('click', function (e) {
17
+ if (e.target.classList.contains('heading')) {
18
+ console.log('hello there ');
19
+ }
20
+});
21
+btn.addEventListener('click', addElement);
0 commit comments