Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
Quiero convertir los botones de radio en estrellas para la calificación de estrellas. seguí varios tutoriales pero ninguno me funciona

 $(".rating input:radio").attr("checked", false); $('.rating input').click(function() { $(".rating span").removeClass('checked'); $(this).parent().addClass('checked'); }); $('input:radio').change(function() { var userRating = this.value; alert(userRating); });
 .rating { float: left; width: 300px; } .rating span { float: right; position: relative; } .rating span input { position: absolute; top: 0px; left: 0px; opacity: 0; } .rating span label { display: inline-block; width: 30px; height: 30px; text-align: center; color: #FFF; background: #ccc; font-size: 30px; margin-right: 2px; line-height: 30px; border-radius: 50%; -webkit-border-radius: 50%; } .rating span:hover~span label, .rating span:hover label, .rating span.checked label, .rating span.checked~span label { background: #F90; color: #FFF; }
 <html> <head> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script> </head> <body> <form method="post" action="star.php"> <div class="rating"> <span><input type="radio" name="ratingg" id="str5" value="5"><label for="str5"></label></span> <span><input type="radio" name="ratingg" id="str4" value="4"><label for="str4"></label></span> <span><input type="radio" name="ratingg" id="str3" value="3"><label for="str3"></label></span> <span><input type="radio" name="ratingg" id="str2" value="2"><label for="str2"></label></span> <span><input type="radio" name="ratingg" id="str1" value="1"><label for="str1"></label></span> </div> <label for="review">Your review about the place.</label> <textarea name="review" id="review" col="5" row="30"></textarea> <input type="hidden" name="product_id" id="product_id" value="<?=$row['id']?>"> <input type="submit" name="submit"> </form> </body> </html>

todo funciona bien. Solo necesito que estos botones de radio se muestren como estrella. Ayúdame con css, por favor.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

por favor use el icono de fuente impresionante aquí está el enlace

https://fontawesome.com/icons

busque el icono de estrella, obtendrá el icono adecuado que desee y póngalo en la etiqueta que ha puesto en su código.

 <label><i class="fa-solid fa-star"></i></label>

este es el enlace del archivo JS, descargue el archivo desde aquí que se usa para mostrar los íconos.

https://drive.google.com/file/d/1eLhUjVd4ldCFmIgJLkUtFVfLUjEYZdW5/view?usp=sharing

y luego reemplace el siguiente código css que ha hecho.

 .rating span label { display: inline-block; width: 30px; height: 30px; text-align: center; color: #ccc; font-size: 30px; margin-right: 2px; line-height: 30px; border-radius: 50%; -webkit-border-radius: 50%; } .rating span:hover~span label, .rating span:hover label, .rating span.checked label, .rating span.checked~span label { color: #F90; }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!