Checkbox’ni tekshirish


JavaScript yordamida checkbox belgilangan yoki belgilanmaganini tekshiring.


Checkbox belgilanganda biror matnni ko‘rsating:

Checkbox:
ULASHISH

Checkbox belgilanganini tekshirish

1-qadam) HTML qo‘shing:

Misol

Checkbox: <input type="checkbox" id="myCheck" onclick="myFunction()"> <p id="text" style="display:none">Checkbox is CHECKED!</p>

2-qadam) JavaScript qo‘shing:

Misol

function myFunction() {   // Get the checkbox   var checkBox = document.getElementById("myCheck");   // Get the output text   var text = document.getElementById("text");   // If the checkbox is checked, display the output text   if (checkBox.checked == true){     text.style.display = "block";   } else {     text.style.display = "none";   } }
O‘zingiz sinab ko‘ring »


W3Schools Pathfinder

Yutuqlaringizni kuzating – bu bepul!