showing results for - "div non selectabel text"
Letitia
23 Jan 2017
1
2        
3            
4        
5     <!DOCTYPE html>
6<html>
7
8<head>
9    <meta charset="utf-8">
10    <title>JavaScript appendChild() Demo</title>
11</head>
12
13<body>
14    <ul id="menu">
15    </ul>
16    
17    <script>
18        function createMenuItem(name) {
19            let li = document.createElement('li');
20            li.textContent = name;
21            return li;
22        }
23        // get the ul#menu
24        const menu = document.querySelector('#menu');
25        // add menu item
26        menu.appendChild(createMenuItem('Home'));
27        menu.appendChild(createMenuItem('Services'));
28        menu.appendChild(createMenuItem('About Us'));
29    </script>
30</body>
31
32</html>
33