From b6c44658563baf921004857d51b94114703f5983 Mon Sep 17 00:00:00 2001
From: Garrett Johnson
Date: Sun, 5 Feb 2012 17:08:22 -0500
Subject: [PATCH 1/2] 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/2] 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!
+
+
+### Placement
+
+Placement of the previous two options is important and can vary depending on the situation. If we are including some JavaScript which does not access the elements on the page, we can safely place the script before the closing HTML head tag. However, if the code will interact with the elements on the page, we have to make sure those elements exists at the time of our script's execution. A common pitfall can be seen in the following example where we attempt to find the element with an ID of "hello-world", the problem here is our script will be executed prior to the element being defined within the document.
+
+
+
+
+
+
+
+
+
Hello World
+
+
+
+
+It is a common pattern to just move our scripts to the bottom of the page, prior to the closing HTML body tag. This will guarentee the defination of any element we may need when our script is executed.
+
+
+
+
+
+
+
+