mardi 10 mars 2020

Laravel: rating system Javascript display

I'm making a review system. I'm done with the post, but the get and display wont perfectly work. Can you please help me with this.

HTML:

<input type="hidden" id="aa" value="" />
<div id="d"></div>

JAVASCRIPT:

var wrapper2 = document.getElementById("d");
var rating = 0;
var myHTML2 = '';
var rating = document.getElementById("aa").value;
var nonee= 0;
nonee = 5 - rating;

for (var w = 0; w <rating; w++) {
    myHTML2 += '<span class="fa fa-star"></span>';
}
for (var e = 0; e <nonee; e++) {
    myHTML2 += '<span class="fa fa-star-o"></span>';
}  

wrapper2.innerHTML = myHTML2;

The result should be three reviews along with the rating but it will only display the rating in the first review, the rest none.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire