js 评级五星设置

<input type="text" class="tt" style="color:red;border-style:none">

js:

var rate=2; 
$('.tt').attr('value','★★★★★☆☆☆☆☆'.substring(5-rate,10-rate));

其中rate为变量,代表实心星的数量,效果:

原文地址:https://www.cnblogs.com/ckxlovejava/p/7463024.html