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 trial

JavaScript

e.currentTarget.reset();

gets the error "TypeError: e.currentTarget.reset is not a function"

5 Answers

Hi 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

Hi John!

Can you send me info (a link, if possible) to the course/video/challenge?

It would help me dig deeper...

Thanks!

-Pete

https://teamtreehouse.com/library/refs-and-the-dom

Please let me know how I can ask in that section next time too.

Hi 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!

Found it...

4:05-ish...

:)

Hi 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...)

Hi 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.