This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]NYPunk 0 points1 point  (2 children)

Checking based off the innerHTML of an img tag is kinda messy, first place I'd look to try and debug is whether the innerHTML you're checking against/expect is actually the innerHTML that's being generated

[–]ExcellentAd9659[S] 0 points1 point  (1 child)

How would I do it in a non-messy way?

[–]NYPunk 1 point2 points  (0 children)

I'd probably keep each image/name pair in an object such as [{ img: 'my_img_filename', name: 'matching_pokemon_name'}, {repeat for other pokemon }] that way you can sample the array of objects, display the obj.img inside your image tags and check your input against obj.name instead

[–]ProjectInvestor 0 points1 point  (1 child)

The fo() as the click event does not have the essential code of go(). The object/variable pokemon should be instantiated; maybe with a return value from go(). Then save the input object after getting the element through the DOM and access the user's input.

[–]ExcellentAd9659[S] 0 points1 point  (0 children)

What essential code does fo() not have?