परिचय
HTML DOM इनपुट मंथ stepUp() मेथड इनपुट मंथ फील्ड के मान को निर्दिष्ट मान से बढ़ाता (इन्क्रीमेंट करता है)।
सिंटैक्स
object.stepUp(number)
यदि number पैरामीटर छोड़ा जाता है, तो यह मान को 1 से बढ़ाता है।
उदाहरण
मंथ इनपुट फील्ड के मान को बढ़ाना/घटाना:
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM stepUp()/stepDown() डेमो</title>
<style>
body { text-align: center; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat; height: 100vh; color: #fff; }
p { font-size: 1.5rem; }
input { width: 40%; }
button {
background-color: #db133a;
color: #fff;
padding: 8px;
border: none;
width: 120px;
margin: 1rem;
border-radius: 50px;
outline: none;
cursor: pointer;
}
</style>
</head>
<body>
<h1>stepUp()/stepDown() मेथड डेमो</h1>
<p>हाय! अपनी जन्म तिथि का महीना चुनें</p>
<input type="month">
<br>
<button onclick="incValue()">StepUp मान</button>
<button onclick="decValue()">StepDown मान</button>
<script>
function incValue() {
document.querySelector("input").stepUp();
}
function decValue() {
document.querySelector("input").stepDown();
}
</script>
</body>
</html>
आउटपुट
"StepUp मान" या "StepDown मान" बटन पर क्लिक करके मंथ इनपुट फील्ड के मान को बढ़ाएं या घटाएं।