mercredi 23 juin 2021

How to optimize this page?

I need to optimize this page. Who can help me please? I didn't write the code for a long time. I forgot a lot of things :( Please help! I wanna optimize the code.

<div class="rating">
        <span id="eight-stars" onclick="vote(3); document.getElementById('eight-stars').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 3 stars out of 5">&#9734;</span>
        <span id="seven-stars" onclick="vote(2);  document.getElementById('seven-stars').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 2 stars out of 5">&#9734;</span>
        <span id="six-star" onclick="vote(1); document.getElementById('six-star').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 1 star out of 5">&#9734;</span>
        <span id="five-stars" onclick="vote(5);  document.getElementById('five-stars').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 5 stars out of 5">&#9734;</span>
        <span id="four-stars" onclick="vote(4);  document.getElementById('four-stars').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 4 stars out of 5">&#9734;</span>
        <span id="three-stars" onclick="vote(3); document.getElementById('three-stars').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 3 stars out of 5">&#9734;</span>
        <span id="two-stars" onclick="vote(2);  document.getElementById('two-stars').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 2 stars out of 5">&#9734;</span>
        <span id="one-star" onclick="vote(1); document.getElementById('one-star').style.color = '#ff6266'" data-toggle="tooltip" data-placement="bottom" title="Rate 1 star out of 5">&#9734;</span></div>

My code

Also, I'll be really happy if you'll help me to fix something. When I click on the star, I can't change it back by clicking it again. Also, I can't fix the name or add another name from the page. I don't know how do that. HELP! PLEASE!




Aucun commentaire:

Enregistrer un commentaire