3
利用伪元素、:checked、~兄弟选择器实现5星评分
source link: https://xushanxiang.com/star-rating.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
利用伪元素、:checked、~兄弟选择器实现5星评分
效果如下:
关键代码:
rate.value=parseInt(Array.from(document.querySelectorAll(`input[name='rating']`)).filter(e=>e.checked)[0].value)
详情请看:演示。
如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK