0

[SOLVED] Input date value null

Check the code bellow to see and fix the problem https://code.sololearn.com/WxEcRarwAYl1/?ref=app

30th Jan 2022, 12:58 PM
EsaKurniawan
18 Answers
+ 1
Remove the .value
30th Jan 2022, 1:22 PM
Razi Bravo
Razi Bravo - avatar
+ 1
And also remove get date and add .value there
30th Jan 2022, 1:22 PM
Razi Bravo
Razi Bravo - avatar
+ 1
Already solved it
30th Jan 2022, 1:51 PM
EsaKurniawan
+ 1
inputDate,addEventListener( 'input', (evt) => { console.log(new Date(evt.target.value).getDate()); });
30th Jan 2022, 2:23 PM
Ipang
0
U didnt made a input element thats why it's showing error
30th Jan 2022, 1:09 PM
Razi Bravo
Razi Bravo - avatar
0
I make input element, look at the code didn't you see that?
30th Jan 2022, 1:13 PM
EsaKurniawan
0
The problem is u have put script tag above your input tag
30th Jan 2022, 1:14 PM
Razi Bravo
Razi Bravo - avatar
0
Script tag should be the last element in html
30th Jan 2022, 1:14 PM
Razi Bravo
Razi Bravo - avatar
0
EsaKurniawan Why did you add addEventListener ?
30th Jan 2022, 1:14 PM
Mohammed
0
It throw an error again man helppp me
30th Jan 2022, 1:16 PM
EsaKurniawan
0
It's says inputDate.getDate() is not a function
30th Jan 2022, 1:16 PM
EsaKurniawan
0
Mohammed because i want every time inputDate is change then I'll display inputDate value to console
30th Jan 2022, 1:18 PM
EsaKurniawan
0
But i just want to get date from that input not a date+ month + year
30th Jan 2022, 1:24 PM
EsaKurniawan
0
Then change the input type to date
30th Jan 2022, 1:30 PM
Razi Bravo
Razi Bravo - avatar
0
The input type is already date from we starting this conversation
30th Jan 2022, 1:34 PM
EsaKurniawan
0
If u just want date then don't have to us input tag u can directly get date month everything separately just using js
30th Jan 2022, 1:43 PM
Razi Bravo
Razi Bravo - avatar
0
Let d = new Date(); Console.log(d.getDate())
30th Jan 2022, 1:46 PM
Razi Bravo
Razi Bravo - avatar
0
Because i want date from user input
30th Jan 2022, 1:47 PM
EsaKurniawan