Hello,
it looks an easy question but I am using an input tag with type="date" like that:
<form> <label>Birth date:</label><input type="date" id="tfdate"><br> <label>Email:</label><input type="email" id="tfmail"><br> <label>Login:</label><input type="text" id="tflogin"><br> <label>Password:</label><input type="password" id="tfpwd"><br> <button onclick="login();">Enter</button> </form>
and this is my login() function:
function login(){ sessionStorage.setItem("nomp", document.getElementById("tfnom").value); alert(document.getElementById("tfdate").value); window.open("page2.html"); }
it works well, and its displays (eg: 2015-02-02), but I would like to extract the day, month and year, so what should I do? I've tested the following sentence and it didn't work:
alert(document.getElementById("tfdate").value).getMonth());