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

How do i Remove a Pet once started ? #19

Open
Hansson0728 opened this issue May 13, 2022 · 2 comments
Open

How do i Remove a Pet once started ? #19

Hansson0728 opened this issue May 13, 2022 · 2 comments

Comments

@Hansson0728
Copy link

runnig Pet.remove() will remove sheeps most of the time, but the "black" ones wont be removed

@Adrianotiger
Copy link
Owner

Do you mean on the webpage? The script on the webpage is not able to create "childs" like a black sheep.

@Hansson0728
Copy link
Author

i did this to fix it:
added a "sheep" prefix to the creation of div:
this.id = "sheep" + Date.now() + Math.random(),

to remove all sheeps
var elements = document.querySelectorAll([id^="sheep"]);
for (let i = 0; i < elements.length; i++) {

	while (elements[i].firstChild) {
		elements[i].firstChild.remove()
	}
	
}

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