Form value not showing | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Form value not showing

Am trying to get the value of the form Input using a function but it's not working https://code.sololearn.com/W9GQGRanmesm/?ref=app

13th Jan 2019, 4:29 AM
idris
idris - avatar
4 Answers
+ 2
You are using wrong ID name in your JavaScript function. ID of the textbox is email. So you have to use that ID in your function. function checkInp(fieldId){ var val=document.getElementById('email').value; console.log(val); }
13th Jan 2019, 4:38 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
idris Since you passed the input element via the function you don't need to try and get it again by getElementById() https://code.sololearn.com/WY9uZdlA5H3C/#html
13th Jan 2019, 5:28 AM
ODLNT
ODLNT - avatar
0
Why can't I pass fieldId in the get element because in the html I already passed email in there?
13th Jan 2019, 5:02 AM
idris
idris - avatar
0
Thank you so much it makes so much sense to me now
13th Jan 2019, 5:58 AM
idris
idris - avatar