Bummer! You must be logged in to access this page.

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 basics

I can not do this with out being able to follow along. The editor crimson does not join the htm file and the myscript.js file. So I can watch the videos but have no way to do any of the functions?

16 Answers

You only open the html file in your browser (Chrome). Once that page is open, go to the menu View -> Developer -> JavaScript Console in Chrome. You should see a nice message from your script after doing so :)

The editor you use shouldn't make a difference. You don't "join" a javascript file and an HTML file. You link the to the javascript file in the html file. For example, to link to jQuery if you have it inside a js folder in your project, you would place the following code, usually inside the head tags.

<script language="javascript" type="text/javascript" src="js/jquery-1.8.3.js"></script>

Well the instructions said to enter <script src="myscript.js"></script> with in the head elements . But when I look into the browser i see the web site and it says what it is supposed to but it does not show the message from" myscript.js "Like in the instruction video it shows "Hello from myscript.js". I thought that was just because of my browser or some thing but the next few videos continue on about the two files working together but they do not using this method. When the instructor does the "if" The "else" command it does not show anywhere in my website or browser. So I have nothing to work with and not sure where to go with this and have spent a day wasting time trying to get help.

Something is amiss in your code. Go to http://codepen.io and copy in what you have and link it to us so I can give it a better look.

<p data-height="268" data-theme-id="0" data-slug-hash="gwcys" data-user="mack45" data-default-tab="result" class='codepen'>See the Pen <a href='http://codepen.io/mack45/pen/gwcys'>gwcys</a> by Bruce Mackay (<a href='http://codepen.io/mack45'>@mack45</a>) on <a href='http://codepen.io'>CodePen</a></p> <script async src="//codepen.io/assets/embed/ei.js"></script>

I copied your code exactly into two files and saved the html as index.html, and saved the script as myscript.js and I put them in the same folder and it worked fine. When I looked at the console in Chrome it displays the "Hello from myscript.js" text which is all that the code you gave me should do. I'm not sure what if else statement you're referring to since there was none in your code.

There is one error in your html tag at the top. It should be lang="en" not l ang="en" but your code still worked without me correcting that.

Yes I played with the code trying to find a problem and like I said it shows the code still working but the message from the .js file does not show?

Then as I proceed I am supposed to add to the .js file to proceed but nothing works.

It shows for me in my console. What browser are you using and are you sure you're checking the right console?

I use chrome but have IE and firefox as well

-Does the "Hello from myscript.js" show in the console? (I'm not sure if you're saying that part worked and then the stuff after that didn't work or if none of it worked)

-Did you fix what I said about lang="en" having a space after the L?

What console am I supposed to check ? I only check the browser. I tried to open the .js file on the dashboard and it gives an console undefined error

Ok I found it in my browser it is under tools>javascript console. I missed finding this in the video instructions. Thank you very much for your patience. I can now go forward and get the next steps done. I really appreciate your help. Have a great evening.

Glad we got it working!

Oh and btw Bruce you might be better off if you follow this track instead of jumping straight into JavaScript Foundations. http://teamtreehouse.com/tracks/learn-javascript-and-jquery

Hi Colin I have done a course in HTML and CSS in college last semester. I am not the best at it but I have also built lots of websites using Word Press. So I may not be very good yet but I do have some training just not at treehouse.com