HTML DOM ইনপুট চেকবক্স ডিফল্ট চেক করা সম্পত্তি HTML এ একটি চেকবক্সের চেক করা বৈশিষ্ট্যের ডিফল্ট মান প্রদান করে।
সিনট্যাক্স
নিচের সিনট্যাক্স −
object.defaultChecked
উদাহরণ
ডিফল্ট চেক প্রপার্টি -
এর একটি উদাহরণ দেখা যাক<!DOCTYPE html>
<html>
<head>
<title>HTML DOM checked property</title>
<style>
body{
text-align:center;
}
p{
font-size:1.5rem;
color:#ff8741;
}
input{
width:30px;
height:30px;
}
button{
background-color:#db133a;
color:#fff;
padding:8px;
border:none;
width:180px;
margin:0.5rem;
border-radius:50px;
outline:none;
font-weight:bold;
}
.show-msg{
color:#db133a;
font-size:1.5rem;
font-weight:bold;
}
</style>
</head>
<body>
<h1>checked Property Example</h1>
<p>Are you smart?</p>
<input type="checkbox" checked>
<br>
<button onclick="check()">Lets Check? Click me</button>
<div class="show-msg"></div>
<script>
function check() {
var input = document.querySelector("input");
var showMsg = document.querySelector(".show-msg");
if(input.defaultChecked === true){
showMsg.innerHTML="You are right!You are smart by default";
} else {
showMsg.innerHTML="Hmmmmm!You are not smart by default";
}
}
</script>
</body>
</html> আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবে

“চেক করা যাক? আমাকে ক্লিক করুন চেকবক্সটি ডিফল্টরূপে চেক করা আছে কিনা তা পরীক্ষা করার জন্য ” বোতাম?
