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

why the reset button dosnt work? #4

Open
hizone opened this issue Jan 10, 2018 · 7 comments
Open

why the reset button dosnt work? #4

hizone opened this issue Jan 10, 2018 · 7 comments
Assignees

Comments

@hizone
Copy link

hizone commented Jan 10, 2018

hi i use your script
but when i click to reset button i get error:
hadar.html:57 Uncaught ReferenceError: reset is not defined
at HTMLDivElement.onclick (hadar.html:57)

plz fix that

thanks

@sebastianwachter
Copy link
Owner

Hi,

What are you doing in the handler of the reset button?
Can you send me your code so I can inspect what you are doing wrong?

Regards

@sebastianwachter sebastianwachter self-assigned this Jan 10, 2018
@hizone
Copy link
Author

hizone commented Jan 10, 2018

its ok i fix that
i use your example
and chage that to work

thanks :)

i add that to my JS file:
reset = function(){
var scratch = new ScratchCard(options);
}

@sebastianwachter
Copy link
Owner

sebastianwachter commented Jan 11, 2018

Actually you should be able to bind to the reset function. What you are doing is creating a new instance of the scratchcard object which works since this will fill the scratchcard with color again but is not the recommended way.

Try the following:

const scratch = new ScratchCard(options);
document.getElementById('myButton').addEventListener('click', () => {
    scratch.reset();
});

@hizone
Copy link
Author

hizone commented Jan 11, 2018

u can give me your skype
i need your help with that plz

@sebastianwachter
Copy link
Owner

sebastianwachter commented Jan 11, 2018

Sorry I do not use Skype.
But you can create a hastebin with your code.

@hizone
Copy link
Author

hizone commented Jan 11, 2018

https://hastebin.com/emovikugop.http
look herer
i cant Scratch all over the card
help me with that plz

@hizone
Copy link
Author

hizone commented Jan 12, 2018

?

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