I can't understand the problem , please help ... | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
1st May 2024, 4:54 PM
Mahi
Mahi - avatar
3 Respostas
+ 6
Two issues. 1. You are using querySelector wrong. Refer to a class with dot prefix, like ".circle" 2. Enclose all your code on JS tab in an IIFE linked to the onload event. onload=()=>{ // all your code }
1st May 2024, 5:36 PM
Tibor Santa
Tibor Santa - avatar
+ 1
<script> /* Created by Mahi */ const $percent = document.querySelector('.percent'); // Corrected selector const $circle = document.querySelector('.circle'); // Corrected selector let load = 0; function update() { load += load < 100 ? 1 : 0; // Corrected increment $percent.textContent = load; // Corrected setting inner text $circle.style.background =`conic-gradient(from 0deg at 50% 50%,#6f7bf7 0%,#9bf8f4 50%,#101012 50%) ${load}%`; } setInterval(update, 150); </script> In javascript, your missing the( . ) which is very important for class selectors. Second case: wrong increment, you have to make increment load when lesser than 100. Third case : missing the(. Textcontent) . Consider all these.
2nd May 2024, 2:17 AM
Vidhya Tharan
Vidhya Tharan - avatar
0
Thanks for helps everyone
2nd May 2024, 1:14 PM
Mahi
Mahi - avatar