Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chapter17-jquery.md #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions manuscript/chapter17-jquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ When it loads, you should be greeted with a load of JavaScript code that is seem
{lang="html",linenos=off}
<script src="{% static "js/jquery-3.3.1.min.js" %}" crossorigin="anonymous"></script>

This now points the browser to look for JQuery in your `static/js` directory, rather than directly from the JQuery servers. Once you have done this, you'll want to then create a new, blank file in the `js` directory called `rango-query.js`. We'll be adding in some JavaScript code that uses JQuery to add functionality to our Rango app. Of course, we'll also need to add a reference to this new file in our `base.html` template, too. Underneath the line you just tweaked, add the following.
This now points the browser to look for JQuery in your `static/js` directory, rather than directly from the JQuery servers. Once you have done this, you'll want to then create a new, blank file in the `js` directory called `rango-jquery.js`. We'll be adding in some JavaScript code that uses JQuery to add functionality to our Rango app. Of course, we'll also need to add a reference to this new file in our `base.html` template, too. Underneath the line you just tweaked, add the following.

{lang="html",linenos=off}
<script src="{% static "js/rango-jquery.js" %}" crossorigin="anonymous"></script>
Expand Down Expand Up @@ -91,7 +91,7 @@ This time, we have another button, but there is no code associated with it. Inst
{lang="javascript",linenos=off}
$(document).ready(function()) {

$('#about-btn').click(function()) {
$('#about-btn').click(function() {
alert('You clicked the button using JQuery!');
});

Expand Down Expand Up @@ -195,4 +195,4 @@ This chapter has provided a very rudimentary guide to using JQuery, and how you
T> ### Performing a Hard Refresh
T> When working with `static` files -- especially JavaScript (that changes often when you are developing) -- you may find that your changes don't filter down to your browser, even though you saved the file!
T>
T> Browsers are developed to try and reduce used bandwidth as much as possible. If you request a page multiple times, it is likely that after the initial request, the content you see will be stored in a *browser cache* on your computer. This means that when developing your project (and changing things rapidly), content may not be refreshed with the most up-to-date implementation. The solution to this problem is to either clear your browser's cache, or to perform a [*hard refresh*](https://refreshyourcache.com/en/cache/). The command you issue depends on your browser and operating system. Windows systems should work with CTRL+F5, with Macs using CMD+SHIFT+R.
T> Browsers are developed to try and reduce used bandwidth as much as possible. If you request a page multiple times, it is likely that after the initial request, the content you see will be stored in a *browser cache* on your computer. This means that when developing your project (and changing things rapidly), content may not be refreshed with the most up-to-date implementation. The solution to this problem is to either clear your browser's cache, or to perform a [*hard refresh*](https://refreshyourcache.com/en/cache/). The command you issue depends on your browser and operating system. Windows systems should work with CTRL+F5, with Macs using CMD+SHIFT+R.