Ask coding questions

← Back to all posts
How to get value of a numeric input in JavaScript?
RixTheTyrunt

I can't find out, how to "grab" the value of a input by id inputTemperature, I tried:

  • value
  • innerText
  • innerHTML

Just please help me...

Answered by ch1ck3n [earned 5 cycles]
View Answer
Voters
RixTheTyrunt
Comments
hotnewtop
ch1ck3n

the script tag should be after the body

so remove the script tag in the head and the ending of the body tag should be like:

RixTheTyrunt

No no no, a HTML CSS and JavaScript book told me to put the script tag before a closing tag of the head, so I am listening to that book

ch1ck3n

@RixTheTyrunt trust me that book is wrong

RixTheTyrunt

I think it's not, because then it worked for me!

RixTheTyrunt

OK, I've moved the <script> tag to the end of body

ch1ck3n

@RixTheTyrunt
also your js is wrong

is correct

Coder100

hmmm both are wrong

yours is bad practice
the book is misleading

You should always put your code in like this:

if you put it in before the <body> tag to confirm the page actually loaded.
@ch1ck3n

ch1ck3n

@Coder100 screw good practice

RixTheTyrunt

What should I put there?

RixTheTyrunt

Why is maintenanceMode = true true?