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 trialMOSHE SCHWIMMER
6,301 PointsquerySelector and innerHTML vs document.write
Why do we need this whole headache from querySelector and innerHTML , when u can use the "document.write" method, ?
1 Answer
Johnathan Guzman
7,432 PointsHey Moshe ! The innerHTML property can be used to change any existing content(could be a blank space) whereas document.write can be used similarly without targeting any elements.
I hope this helps.
Gary Angarita
Full Stack JavaScript Techdegree Student 1,878 PointsGary Angarita
Full Stack JavaScript Techdegree Student 1,878 PointsSo, if you use innerHTML, you're adding it to the html file AND the .js file? In other words, one method adds it to two places (making it permanent) and the other one just keeps it in your .js file?