Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of null (reading 'value' #136

Open
Teslimat opened this issue Jul 14, 2024 · 2 comments
Open

TypeError: Cannot read properties of null (reading 'value' #136

Teslimat opened this issue Jul 14, 2024 · 2 comments

Comments

@Teslimat
Copy link

When I tried console.log(quantity)
I received the error message "TypeError: Cannot read properties of null (reading 'value')
at HTMLButtonElement. (amazon.js:75:46)"

@Teslimat
Copy link
Author

Here is a screenshot of my js code. Kindly assist

Screenshot 2024-07-14 at 11 17 27 AM Screenshot 2024-07-14 at 11 17 48 AM

@Schemper
Copy link

Hi Teslim, according to the error in your message, the problem appears to be on line 75. The correct code should be:

const quantity = Number(quantitySelector.value)

The difference here is, the value gotten from the quantity selector is converted to number from string. You can check this out.
P.S. I am still learning so I might be way off but I was able to check compare my code with yours and since I am a little bit ahead and thought to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants