@thisisharsh7
Posted
Hey Goorezy, Well done ! your solution works well. In order to answer your query I would like to suggest some key points you should consider
- Avoid writing more code on html, I go through your code and I found your html contain lots of div instead use div only where it need. Using lots of div and classes will mesh you up when you write code for CSS and JavaScript.
- Avoid pasting full SVG code on html instead use
<img src=".svg" alt="svg here">
this will make your html content shorter and readable. - When you work with JavaScript if there are no. of DOM elements and then adding every element a event listener this creates problem. Avoid using many query selector in same type of event instead use query selector all like for button click you can write
const btn = document.querySelecterAll("button");
this will select all the buttons on your page then you can differentiate button by giving them properid
and then apply event listener likebtn.forEach(sbtn=> {sbtn.addEventListener("click", function)});
heresbtn
indicates a single button.
Hope it help you in improving your solution....