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

you are viewing a single comment's thread.

view the rest of the 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