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
Daniel Grieve
6,432 PointsPurpose of setAttribute method - JS
When using the Console/ DOM, what is the point in using the methods getAttribute/setAttribute, when the changes these methods make are only temporary?
Is it merely to see what the site would look like after a small change or is there some way to link your HTML file to the console which would result in a permanent change?
1 Answer
Steven Parker
243,318 PointsChanges made in the console are only for testing and evaluation. Once you determine what you want done, you would then transfer that to a <script> in your HTML file or to an external .js file that your page loads.
Antti Lylander
9,686 PointsAntti Lylander
9,686 PointsNothing you do in console will be saved. It is indeed possible to link JavaScript to HTML so that it will be run every time the page loads or button is clicked etc.