From b6c44658563baf921004857d51b94114703f5983 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 5 Feb 2012 17:08:22 -0500 Subject: [PATCH 1/4] rearranged some wording, added some emphasis on the importantence of understanding javascript --- content/javascript-101/dex.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/content/javascript-101/dex.md b/content/javascript-101/dex.md index 9ac27633..f2376b9f 100644 --- a/content/javascript-101/dex.md +++ b/content/javascript-101/dex.md @@ -5,9 +5,6 @@ section : 1 attribution: jQuery Fundamentals --- -jQuery is built on top of JavaScript, a rich and expressive language in its own -right. This section covers the basic concepts of JavaScript, as well as some -frequent pitfalls for people who have not used JavaScript before. While it will -be of particular value to people with no programming experience, even people -who have used other programming languages may benefit from learning about some -of the peculiarities of JavaScript. +jQuery is built on top of JavaScript, a rich and expressive language in its own right. This means when using jQuery, we are still writing valid JavaScript; it just serves as a framework to make many aspects of writing JavaScript easier and more reliable in the various browser environments. With that said, a basic knowledge of JavaScript will go a long way in understanding, structuring, and debugging our code; jQuery will just help make that basic knowledge go much, much further. + +This section covers the basic concepts of JavaScript, as well as some frequent pitfalls many developers fall into during their first foray into the language. While it will be of particular value to people with little to no programming experience, even people who have used other programming languages may benefit from learning about some of the peculiarities of JavaScript. \ No newline at end of file From 1e6b75b40794adb496ea89fcb925506479e3501b Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 5 Feb 2012 21:13:15 -0500 Subject: [PATCH 2/4] new section on how to run code --- content/javascript-101/running-code.md | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 content/javascript-101/running-code.md diff --git a/content/javascript-101/running-code.md b/content/javascript-101/running-code.md new file mode 100644 index 00000000..36a03f13 --- /dev/null +++ b/content/javascript-101/running-code.md @@ -0,0 +1,81 @@ +--- +chapter: javascript-101 +section: 1 +title: Running Code +attribution: jQuery Fundamentals +github: jquery +--- + +### External + +The first and recommended option is to write our code in an external file (with a ".js" extension), which can then be included on our web page using a HTML script tag and pointing the "src" attribute to our file's location. Having our JavaScript in it's own file will reduce code duplication if we wish to reuse it on other pages and will allow the browser to cache the file on the remote client's computer, decreasing our page load time. + + +alert('Hello World!'); + + + + + + +### Inline + +The second option is to inline the code directly on the web page. This is also achieved using HTML script tags but instead of pointing the "src" attribute to a file, we place the code between the tags. While there are use cases for this option, the majority of the time it is best to keep our code in an external file as described above. + + + + + +### Attributes + +The last and strongly discouraged option, is to utilize the event handler attributes of HTML attributes. + + +Click Me! +