HTML DOM Input Datetime disabled Property

HTMLWeb DevelopmentFront End Technology

<p>The HTML DOM Input Datetime disabled property sets/returns whether Input Datetime is enabled or disabled.</p><h2>Syntax</h2><p>Following is the syntax &minus;</p><ul class="list"><li>Returning boolean value - true/false</li></ul><pre class="result notranslate">inputDatetimeObject.disabled</pre><ul class="list"><li>Setting <strong>disabled&nbsp;</strong>to booleanValue</li></ul><pre class="result notranslate">inputDatetimeObject.disabled = booleanValue</pre><h2>Boolean Values</h2><p>Here, <strong>&ldquo;booleanValue&rdquo;</strong> can be the following &minus;</p><table class="table table-bordered"><thead><tr><th style="text-align: center;">booleanValue<br></th><th style="text-align: center;">Details<br></th></tr></thead><tbody><tr><td>true<br></td><td>It defines that the input datetime is disabled.<br></td></tr><tr><td>false<br></td><td>It defines that the input datetime is not disabled and it is also the default value.<br></td></tr></tbody></table><h2>Example</h2><p>Let us see an example of <strong>Input Datetime disabled</strong> property &minus;</p><p><a class="demo" href="http://tpcg.io/5f04Xi" rel="nofollow" target="_blank">&nbsp;Live Demo</a></p><pre class="prettyprint notranslate">&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Input Datetime Disabled&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; Date &amp; Time: &lt;input type=&quot;datetime&quot; id=&quot;datetimeSelect&quot; value=&quot;1998-04-09T12:48IST&quot; disabled&gt; &lt;/form&gt; &lt;button onclick=&quot;enableDatetimeInput()&quot;&gt;Enable Datetime Input&lt;/button&gt; &lt;div id=&quot;divDisplay&quot;&gt;&lt;/div&gt; &lt;script&gt; &nbsp; &nbsp;var divDisplay = document.getElementById(&quot;divDisplay&quot;); &nbsp; &nbsp;var inputDatetime = document.getElementById(&quot;datetimeSelect&quot;); &nbsp; &nbsp;divDisplay.textContent = &#39;Datetime Input disabled: &#39;+inputDatetime.disabled; &nbsp; &nbsp;function enableDatetimeInput() { &nbsp; &nbsp; &nbsp; inputDatetime.disabled = false; &nbsp; &nbsp; &nbsp; divDisplay.textContent = &#39;Datetime Input disabled: &#39;+inputDatetime.disabled; &nbsp; &nbsp;} &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</pre><h2>Output</h2><p>This will produce the following output &minus;</p><p>Before clicking <strong>&lsquo;Enable Datetime Input&rsquo;</strong> button &minus;</p><p><img src="https://www.tutorialspoint.com/assets/questions/media/25582/input_datetime.jpg" class="fr-fic fr-dib" style="width:600px; height:130px;" width="600" height="130"></p><p>After clicking <strong>&lsquo;Enable Datetime Input&rsquo;</strong> button &minus;</p><p><img src="https://www.tutorialspoint.com/assets/questions/media/25582/after_input_datetime.jpg" class="fr-fic fr-dib" style="width:600px; height:141px;" width="600" height="141"></p>
raja
Updated on 30-Jul-2019 22:30:26

Advertisements