- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Input DatetimeLocal name Property
The HTML DOM Input DatetimeLocal name property returns a string, which is the value of the name attribute of input datetimeLocal. User can also set it to a new string.
Syntax
Following is the syntax −
- Returning string value
inputDatetimeLocalObject.name
- Setting name attribute to a string value
inputDatetimeLocalObject.name = ‘String’
Example
Let us see an example of Input DatetimeLocal name property −
<!DOCTYPE html> <html> <head> <title>Input DatetimeLocal name</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>Datetime-Local-name</legend> <label for="datetimeLocalSelect">Today : <input type="datetime-local" id="datetimeLocalSelect" value="2019-05-23T12:45" name="Rupenzel"> </label> <input type="button" onclick="getnameimum()" value="Who's DOB is this? "> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var inputDatetimeLocal = document.getElementById("datetimeLocalSelect"); function getnameimum() { if(inputDatetimeLocal.value === '2019-05-23T12:45') divDisplay.textContent = 'Above DOB is of '+inputDatetimeLocal.name; else divDisplay.textContent = 'Above DOB is of no one!'; } </script> </body> </html>
This will produce the following output −
Output
Before clicking ‘Who’s DOB is this?’ button −
After clicking ‘Who’s DOB is this?’ button −
Advertisements