HTML DOM ইনপুট নম্বর প্লেসহোল্ডার প্রপার্টি রিটার্ন করে এবং নম্বর ইনপুট ফিল্ডের প্লেসহোল্ডার অ্যাট্রিবিউটের মান পরিবর্তন করে।
সিনট্যাক্স
নিম্নলিখিত সিনট্যাক্স −
-
রিটার্নিং প্লেসহোল্ডার
object.placeholder
-
স্থানধারক পরিবর্তন করা হচ্ছে
object.placeholder = “text”
উদাহরণ
আসুন আমরা HTML DOM ইনপুট নম্বর প্লেসহোল্ডার প্রপার্টির একটি উদাহরণ দেখি -
<!DOCTYPE html>
<html>
<head>
<style>
html{
height:100%;
}
body{
text-align:center;
color:#fff;
background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat;
height:100%;
}
p{
font-weight:700;
font-size:1.1rem;
}
input{
display:block;
width:35%;
border:2px solid #fff;
background-color:transparent;
color:#fff;
font-weight:bold;
padding:8px;
margin:1rem auto;
}
.btn{
background:#0197F6;
border:none;
height:2rem;
border-radius:2px;
width:35%;
margin:2rem auto;
display:block;
color:#fff;
outline:none;
cursor:pointer;
}
</style>
</head>
<body>
<h1>placeholder property Demo</h1>
<p>Hi, Enter your age:</p>
<input type="number" class="numberInput" placeholder="Enter your age">
<button type="button" onclick="change()" class='btn'>Change Placeholder</button>
<script>
function change() {
var numberInput = document.querySelector(".numberInput");
numberInput.placeholder = "Please enter your age";
}
</script>
</body>
</html> আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবে

“প্লেসহোল্ডার পরিবর্তন করুন-এ ক্লিক করুন ” প্লেসহোল্ডারের মান পরিবর্তন করতে বোতাম।
