Introduction to jQuery. Learning Objectives By the end of this lecture, you should be able to: – Describe what is meant by a software library- particularly.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

HTML Basics Customizing your site using the basics of HTML.
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Modifying existing content Adding/Removing content on a page using jQuery.
Downloading, Installing, and Working with Dropbox.
Server-Side vs. Client-Side Scripting Languages
Web Page Behavior IS 373—Web Standards Todd Will.
Russell Taylor Lecturer in Computing & Business Studies.
Small Business Resource Power Point Series Shopping Carts and Your Website.
Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Creating and publishing accessible course materials Practical advise you can replicate.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 21: Publishing Your Pages on the Web.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
Security and JavaScript. Learning Objectives By the end of this lecture, you should be able to: – Describe what is meant by JavaScript’s same-origin security.
Excel Services II: Requirements, recommendations, and permissions What you need for Excel Services As explained in the first course in the series, “Excel.
Website Designing Using Ms FrontPage FrontPage 2003 Create a Web site with FrontPage.
1 Networks and the Internet A network is a structure linking computers together for the purpose of sharing resources such as printers and files Users typically.
WEB DESIGN Dario Smagata
Build a Free Website1 Build A Website For Free 2 ND Edition By Mark Bell.
The Confident Researcher: Google Away (Module 2) The Confident Researcher: Google Away 2.
Chapter 19: Adding JavaScript
The Internet versus the Reference Section The answers are out there…
FACEBOOK IS THE BEST THING THAT EVER HAPPENED TO FRIENDSHIP WHY I LIKE FACEBOOK! By Mike Matthews.
XP Dreamweaver 8.0 Tutorial 3 1 Adding Text and Formatting Text with CSS Styles.
Microsoft FrontPage 2003 Illustrated Complete Finalizing a Web Site.
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials The internet: Blogging Suitable for: Advanced.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Jquery Nasrullah. Jquery jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn.
SharePoint document libraries I: Introduction to sharing files Sharjah Higher Colleges of Technology presents:
Microsoft ® Office SharePoint ® Server 2007 Training Excel Services II: Requirements, recommendations, and permissions [Your company name] presents:
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
Animation & Effects Using JQuery. What is jQuery? jQuery is a lightweight, JavaScript library. The purpose of jQuery is to make it much easier to use.
LEARNING HTML PowerPoint #1 Cyrus Saadat, Webmaster.
Publishing Your Web Pages Ann Emmanuel SIUE Web Administrator
Downloading and Installing Autodesk Inventor Professional 2015 This is a 4 step process 1.Register with the Autodesk Student Community 2.Downloading the.
Introduction to JavaScript CS101 Introduction to Computing.
Creating Google Sites Laura Assem, Director of Technology.
Modifying HTML attributes and CSS values. Learning Objectives By the end of this lecture, you should be able to: – Select based on a class (as opposed.
Unit 13 –JQuery Basics Instructor: Brent Presley.
Changing HTML Attributes each() function Anonymous Functions $(this) keyword.
Review of HTML and CSS A (very) brief review of some key fundamentals to be aware of in IT-238.
+ Publishing Your First Post USING WORDPRESS. + A CMS (content management system) is an application that allows you to publish, edit, modify, organize,
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Validation. What is Validation? Removing errors improves the consistency of how our pages look to a wide variety of browsers and devices. Ensuring that.
EXTERNAL STYLESHEETS AND MORE HTML STYLING HTML and CSS part 2.
Introduction. Internet Worldwide collection of computers and computer networks that link people to businesses, governmental agencies, educational institutions,
WEB DESIGN CONCEPTS Brayden Burr. UNDERSTANDING THE CONTENT.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
MICROSOFT AJAX CDN (CONTENT DELIVERY NETWORK) Make Your ASP.NET site faster to retrieve.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
Dreamweaver – Setting up a Site and Page Layouts
JavaScript/ App Lab Programming:
Microsoft® Office FrontPage® 2003 Training
Database application MySQL Database and PhpMyAdmin
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
Publishing and Maintaining a Website
BTEC NCF Dip in Comp - Unit 15 Website Development Lesson 12 – Publish and Test Mr C Johnston.
Microsoft FrontPage 2003 Illustrated Complete
Dynamic Web Pages JavaScript Jill Thomas Oct 14, 2003.
Browser Support for HTML5
Building Web Applications
Teaching slides Chapter 6.
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Bootstrap Direct quote from source: bootstrap/
Security and JavaScript
Introduction to jQuery
The W3C More on images Entity codes Remote vs Local Computers
Introduction to scripting
Presentation transcript:

Introduction to jQuery

Learning Objectives By the end of this lecture, you should be able to: – Describe what is meant by a software library- particularly as it applies to JavaScript – Describe the need for libraries as applied to the issue of cross-browser compatibility – Describe the role played by jQuery – Install/Configure jQuery to run on your web pages – Become familiar with a page containing everything you need to get started with jQuery that integrates CSS (internal and external), CSS classes, standard JS function, and the jQuery ‘ ready() ’ function.

Rinse, Lather, Repeat, Repeat, Repeat All programmers eventually observe that certain types of tasks/requirements have a habit of appearing over and over again. As an example relating to web design, a common task encountered is to ensure that a specific type of functionality works consistently regardless of which browser the visitor happens to be using. In fact, this particular task is one of the thorniest issues in web design. – The issue is even more pronounced in recent years now that so many people do their web surfing using handheld devices. Skilled JavaScript programmers have made lots of $$$ using JS to help deal with this issue. For example, one can write code to check to see what type of browser the visitor is using, check for the size of their browser window, and then adjust the dimensions of images on their web page accordingly. The code to accomplish a task such as is likely to be: – Tedious – Lengthy – Error-prone To further complicate things, suppose that down the road, a new uber-popular browser gets introduced. Suddenly, your JS code that has tweaked for hours and hours to achieve a certain look based on all the “major” browsers in the past, no longer works for this new, trendy browser.

Software Libraries Software Library: A software library is a collection of code. A JavaScript library is typically a file or collection of files each of which has a bunch JS functions. These files have (usually) been widely tested and finessed to tackle some commonly encountered problems/issues in web page design. Public Domain: These libraries are often in the public domain which means that they are intended (typically) to be free. One of the major benefits to this system, is that there is typically an entire community behind these ventures that is forever adding, modifying, improving the libraries’ code as needed. This means that if some new browser suddenly appears on the scene and becomes insanely popular, it’s only a matter of time before the community will jump in and update the library to deal with issues encountered by the newcomer. – This is very similar to the philosophy behind Wikipedia (and in fact, any ‘wiki’) with which many of you are familiar. There are several JS libraries out there including: – Dojo – Prototype – jsPHP – And…….. jQuery If you wish to use any of these libraries, you can easily download and/or link to any of these libraries in your web pages.

Enter jQuery! Each JS library has its own advantages and disadvantages. Some of the reasons that jQuery has become so popular (and why we have chosen it for this course) include: – Small size: Every time a user visits your page, along with the HTML file, CSS file(s), images and so on that will be needed to be downloaded to their browser, they will also need to download the library. Some versions of the jQuery library are less than 10 k! – Popular: We’re not taking popular in the high-school sense of the word. When it comes to a software library, popular is good since it means that there is a large and active community constantly testing, updating, and improving the code. Tested: Because of the widespread use of jQuery, bugs and other limitations are quickly revealed and fixed. Plug-Ins: These are small add in programs that typically have some highly specialized use. The large jQuery community has resulted in the development of thousands of plug ins. As an example, the little calendar that pops up when you visit some sites and click on a date would take quite a bit of JS progrmaming. However a single line of jQuery code linking to the ‘Datepicker’ plug in would accomplish the same thing! – Free: jQuery is free. Some libraries are developed by commercial software design firms and therefore do cost money. Professionally written and maintained code does of course have its own set of advantages, but again, you (literally) pay for it.

Running jQuery jQuery exists as a single external JS file. You can run jQuery one of two ways: – Download the file to your computer – Link to a remotely hosted version from a reliable and established website Each option has its pros and cons – Download: The main benefit is that if you are offline, the file will still be there on your computer when you are developing your code. – Link: These externally linked files are typically the most up to date. However, it requires that you are online, and also takes a few extra milliseconds which can, in theory, slow down your site a little bit. Still, once your page goes ‘live’, you should use the version linking to an external file. – Here is a link to an article discussing these issues in more detail. Here is a link I would recommend using the externally linked version. – There are many different servers from reputable companys such as Microsoft, Google, jQuery and others. You can easily find links to these online. Here is the link to the latest (as of April 2015) version on Google’s site. – Remember that this link must go in the ‘head’ section of your HTML file. – Note that the closing tag IS required. – Notice that this link refers to version If you encounter links to later versions of jQuery, by all means, use the latest version! – This link must be present on every page in which you use jQuery commands. – Not surprisingly, this link must appear before any jQuery commands you use. – You must be online for this link to work. If you are doing some coding work in an offline environment you will have to download the jQuery library to your computer and link to it locally. IMPORTANT: Links to CSS stylesheets (whether external or internal) must be placed BEFORE Any Javascript programming, including jQuery.

The ‘ ready() ’ function Okay, let’s get started with our first jQuery function! We will begin with a function called ‘ ready() ’, or more specifically, document.ready() The ‘ready’ function executes after the entire web page has finished loading in the visitor’s browser. This is a very important function to be comfortable with since much of what we do in real world JS involves modifying content that has already been loaded and made visible to the user on the page. As a result, you will typically include this function on every page in which you are using jQuery. $(document).ready( function() { // Some jQuery code will // go in here... } ); I am *well* aware that this is some awkward looking code, but, never fear, all will be explained in time!

STUDY AND PRACTICE! See the file: first_jquery.htm As always, study the file closely. Be sure you clearly understand everything that is in the document I don’t expect you to completely understand the ready() function just yet. While I’m sure many of you can see what that line is intended to do, don’t worry if you can’t. We’ll cover it in our next lecture. Don’t be passive - TYPE THE CODE OUT FOR YOURSELF!!! – It’s important not to study “passively”. This means actually typing out the code yourself. Once you’ve typed it out without errors and confirmed that it works, you can – and should – modify and experiment with the code. Your objective is to put everything we’ve done so far together: HTML Comments JS Comments Order (CSS before scripts), Link to jQuery file before any actual jQuery code, etc Use of div sections Use of ID attributes CSS classes External and Internal (aka embedded) CSS JS functions Linking a button to a JS function Syntax of the jQuery ready() function