JavaScript List Items Source Code
<!DOCTYPE html> <html> <head> <title>Code Example</title> <style> .active{ color:green; font-weight:bold; } .inactive{ color:#666; font-weight:100; } </style> </head> <body> <div class=”output”></div> <script src=”app6.js”></script> </body> </html> const output = document.querySelector(‘.output’); const output1 = document.createElement(‘div’); const ul = document.createElement(‘ul’); output.append(output1); output.append(ul); const url = ‘data1.json’; window.addEventListener(‘DOMContentLoaded’,()=>{ output1.textContent = ‘ready’; loadData(); }) function loadData(){ fetch(url).then(rep=>rep.json()) .then((data)=>{ //console.log(data); addtoPage(data); }) … Read more