Ask coding questions

← Back to all posts
Javascript Error
DaxCodes

So I was making a project with my buddy @sqcodes and we came across this javascript error when we submit the "form". It's really weird and we couldn't figure it out

Here's the Error:

TypeError: Cannot read properties of null (reading 'value')
at yes (/script.js:7:46)
at HTMLButtonElement.onclick (/:17:29)

Does anybody have any suggestions?
Thanks!

  • DaxCodes & SQCodes
Answered by MrVoo [earned 5 cycles]
View Answer
Voters
DaxCodes
Comments
hotnewtop
MrVoo

<input if="q2" type="text">
You have 'if' instead of 'id' .-.

DaxCodes

@MrVoo Oh. Thank you!

VulcanWM

For the second input you did if=“q2” instead of id=“q2”

DaxCodes

@VulcanWM Same with you, thanks!

VulcanWM