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 Introduction to Programming Basics Writing Your Program

Rich Rogers
Rich Rogers
1,446 Points

Creating an HTML file in Textmate

Sorry I am lost. In the first section we were typing in javascript commands using the chrome browser. Then we jump to using Textmate to create a myscript.js file. How did the html content make its way into the textmate file as a index.html file? Is there another text editor that I can use? I'm sorry but I feel like I missed something major here. The video seamlessly shuffles from typing commands from within the browser to editing lines in a text editor. Any help would be greatly appreciated.

Rich Rogers
Rich Rogers
1,446 Points

Actually I guess my question is how do I get the textmate or any text editor setup with a working directory. I have been using workspace, but now we are using just a text editor. For example, if I type out some html and view it in the browser it is fine. But if I just add another tab, and name it with a .js, then add the script to the html file, the two are not communicating.

4 Answers

Oliver Brewester
Oliver Brewester
3,180 Points

As long as you have an index.html file and a separate .js file in a folder you are good to go. You just need to link the .js file to the html by putting a src script like this <script src="alertbox1.js"></script> before the closing head tag of the doc. Then put this code in the alert.js file

alert("Hello World");

when you view the html file in the browser you should see an alert box saying hello world. This is a quick and easy way to check that your files are linked correctly.

Oliver Brewester
Oliver Brewester
3,180 Points

You can use any editor you want. The general preference at the moment is Sublime Text. I'm sure the deep dive course has downloadable files to use as a guide as you go. I also have found www.codepen.io useful as you can use it online if you do not have access to a text editor.

Hope it helps

Rich Rogers
Rich Rogers
1,446 Points

Thank you I will try Sublime. And I will look in the notes for the downloadable files.

Rich Rogers
Rich Rogers
1,446 Points

Thank you! Got it up and running now. I really appreciate your help.