Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn Sourour
1,266 Pointse.currentTarget.reset();
gets the error "TypeError: e.currentTarget.reset is not a function"
5 Answers
Peter Vann
36,427 PointsHi John!
These might help:
https://teamtreehouse.com/community/currenttargetreset
https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
I hope that helps.
Stay safe and happy coding!
Peter Vann
36,427 PointsHi John!
Can you send me info (a link, if possible) to the course/video/challenge?
It would help me dig deeper...
Thanks!
-Pete
John Sourour
1,266 Pointshttps://teamtreehouse.com/library/refs-and-the-dom
Please let me know how I can ask in that section next time too.
Peter Vann
36,427 PointsHi John!
If you look at the botton right corner of any video page, you see this:
Need help?
Have questions about this video? Start a
discussion with the community and
Treehouse staff.
[ GET HELP BUTTON ]
(BTW, still looking into your issue!?! Not quite seeing it in the video... Do you have a time stamp?)
I hope that helps.
Stay safe and happy coding!
Peter Vann
36,427 PointsFound it...
4:05-ish...
:)
Peter Vann
36,427 PointsHi John!
Is your code exactly this?:
import React, { Component } from 'react';
class AddPlayerForm extends Component
playerInput = React.createRef():
handleSubmit = (e) => {
e.preventDefault():
This.props.addPlayer(this.playerInput.current.value);
e.currentTarget.reset();
}
render() {
Return (
// (Etc...)
John Sourour
1,266 PointsHi Peter, thanks for your help. Turns out I had the event Listener on the button and not the form. I was looking at the wrong part of the code.
Thank you for your quick responses and sorry for any inconvenience.
John Sourour
1,266 PointsJohn Sourour
1,266 PointsHi Peter!
Thank you for the answer, I'm afraid these didn't clear up why I'm getting the above error, although I followed the tutorial video. (same code)
Thanks in advance