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 JavaScript and the DOM (Retiring) Getting a Handle on the DOM Select a Page Element By Its ID

Mars Epaecap
Mars Epaecap
5,110 Points

I hosted this example on a webpage and it works on my laptop.I tried this in my Iphone and it didn't work. Why?

I hosted this example on a webpage and it works on my laptop.I tried this in my Iphone and it didn't work. Why?

My understanding is Safari has a bug with const where if you define it with the same name as the id of the element it is selecting it won't work. Try changing the name of your const variable and see if it works or try to use var instead. Unfortunately this will happen no matter what browser you put on your iPhone. Even chrome is just a wrapper around the safari window on iOS.

More on the bug

1 Answer

Your iPhone uses Safari, which is not a good web browser to use for TreeHouse.