कैसे करें - चेकबॉक्स चेक किए जाने पर टेक्स्ट प्रदर्शित करें
जांचें कि जावास्क्रिप्ट के साथ चेकबॉक्स चेक किया गया है या नहीं।
चेकबॉक्स चेक किए जाने पर कुछ टेक्स्ट प्रदर्शित करें:
चेकबॉक्स:जांचें कि क्या कोई चेकबॉक्स चेक किया गया है
चरण 1) HTML जोड़ें:
उदाहरण
Checkbox: <input type="checkbox" id="myCheck" onclick="myFunction()">
<p id="text" style="display:none">Checkbox is CHECKED!</p>
चरण 2) जावास्क्रिप्ट जोड़ें:
उदाहरण
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";
}
}