防止页面混乱检查输入
问题描述:
“星级评定”按预期工作https://codepen.io/462960/pen/WZXEWd但每次点击后页面都会弹出。 我试图阻止它防止页面混乱检查输入
const labels = document.querySelectorAll('label');
function noDefault(e){
e.preventDefault();
};
labels.forEach(x => x.addEventListener('click', noDefault));
但它不是一个理想的解决方案,因为它停止从被检查的投入。我无法在网页中使用。任何建议表示赞赏。
答
解决方法:隐藏标签的输入
&:not(:checked) {
> input {
display: none;
//position: absolute;
//top: -9999px;
clip: rect(0,0,0,0);
}
我在Chrome中看到任何页面的跳跃。 – epascarello
@ВладимирМаксименко查看我的解决方案 – krishnar