+ 1
I can't understand the problem , please help ...
https://sololearn.com/compiler-playground/WKzUQKmC61Px/?ref=app
3 Réponses
+ 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
}
+ 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.
0
Thanks for helps everyone