HTML DOM Input URL placeholder प्रॉपर्टी एक स्ट्रिंग सेट/लौटाती है जिसका उपयोग आमतौर पर उपयोगकर्ता को संकेत देने के लिए किया जाता है कि इनपुट टेक्स्ट कैसा दिखेगा।
सिंटैक्स
निम्नलिखित सिंटैक्स है:
स्ट्रिंग मान प्राप्त करना
inputURLObject.placeholder
placeholder को stringValue पर सेट करना
inputURLObject.placeholder = stringValue
उदाहरण
आइए Input URL placeholder प्रॉपर्टी का एक उदाहरण देखें:
<!DOCTYPE html> <html> <head> <title>Input URL placeholder</title> <style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style> </head> <body>
<form>
<fieldset>
<legend>URL-placeholder</legend>
<label for="URLSelect">URL: <input type="url" id="URLSelect"> </label>
<input type="button" value="Get an Example" onclick="setPlaceholder()">
</fieldset>
</form>
<script>
var inputURL = document.getElementById("URLSelect");
function setPlaceholder() {
inputURL.placeholder = 'https://www.google.com';
}
</script> </body> </html>
आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा:
'Get an Example' बटन पर क्लिक करने से पहले:

'Get an Example' बटन पर क्लिक करने के बाद:
