This is my css
.round {
position: relative;
}
.round label {
background-color: #fff;
border: 1px solid #ccc;
border-radius: 50%;
cursor: pointer;
height: 28px;
left: 0;
position: absolute;
top: 0;
width: 28px;
}
.round label:after {
border: 2px solid #fff;
border-top: none;
border-right: none;
content: "";
height: 6px;
left: 7px;
opacity: 0;
position: absolute;
top: 8px;
transform: rotate(-45deg);
width: 12px;
}
.round input[type="checkbox"] {
visibility: hidden;
}
.round input[type="checkbox"]:checked + label {
background-color: #66bb6a;
border-color: #66bb6a;
border-radius:10%;
}
.round input[type="checkbox"]:checked + label:after {
opacity: 1;
}
I made the border radius change in css but couldn't figure it how to make it in js. Can someone please help me :) I am new to javascript so please don't judge me but i tried with
var checkbox=document.getElementById('checkbox');
if (checkbox.checked){checkbox.style.borderRadius="10%";
}
Aucun commentaire:
Enregistrer un commentaire