Introduction to jQuery. 2 Objectives When you complete this chapter, you will be able to: Select elements using jQuery syntax Use built-in jQuery functions.

Slides:



Advertisements
Similar presentations
The jQuery library. What is jQuery ? A javascript lightweight library Is very easy to use Is powerful Is cross-browser compatible Downloadable from jQuery.com,
Advertisements

JQuery CS 380: Web Programming. What is jQuery? jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling,
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Chapter 7: Dynamic HTML and Animation JavaScript - Introductory.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Definition from Wikipedia.  The Prototype JavaScript Framework  implemented as a single file of JavaScript code  named prototype.js (
CST JavaScript Validating Form Data with JavaScript.
JavaScript & jQuery the missing manual Chapter 11
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
A really fairly simple guide to: mobile browser-based application development (part 4, JQuery & DOM) Chris Greenhalgh G54UBI / Chris Greenhalgh.
Introduction to HTML. What is HTML? Hyper Text Markup Language (HTML) is a language for describing web pages. HTML is not a programming language, it is.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
JavaScript, Fourth Edition
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.
1 JavaScript in Context. Server-Side Programming.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
JavaScript Frameworks Presented by Kyle Goins Also see:
JQuery Youn-Hee Han
. Taught by: Muhammad Ali Baloch midahot. WHAT IS JQUERY JQuery is a fast, small, and feature-rich JavaScript library. Simplifies the interaction between.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 10.
INTRODUCTION TO CSS. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features of CSS Features of CSS  Creating Style Sheet Creating Style Sheet.
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
JQuery Introduction © Copyright 2014, Fred McClurg All Rights Reserved.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
JavaScript Library. What is jQuery jQuery is a lightweight JavaScript library. The purpose is to make it easier to use JavaScript code on your website.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Review of the DOM Node properties and methods Some ways of accessing nodes Appending, copying and removing nodes Event handling – Inline – Scripting –
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Visual Basic CDA College Limassol Campus COM123 Visual Programming 1 Semester B Lecture:Pelekanou Olga Week 5: Useful Functions and Procedures.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
Unit 13 –JQuery Basics Instructor: Brent Presley.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Host Objects: Browsers and the DOM
Web Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
Understanding JavaScript and Coding Essentials Lesson 8.
Introduction to JQuery COGS 187A – Fall JQuery jQuery is a JavaScript library, and allows us to manipulate HTML and CSS after the page has been.
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
JQuery “write less, do more”. jQuery - Introduction Simply a JavaScript library to simplify JavaScript programming itself Wraps long standard JavaScript.
Chapter 10 Dynamic HTML (DHTML) JavaScript, Third Edition.
JavaScript 101 Lesson 6: Introduction to Functions.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 5 Host Objects: Browsers.
SharePoint & jQuery. About me Phill Duffy – Product Manager at Lightning Tools Ltd – Author of ‘Pro SharePoint with jQuery’ – MCTS Application Developer.
JQuery Fundamentals Introduction Tutorial Videos
What is jQuery?.
Programming Web Pages with JavaScript
Unit M Programming Web Pages with
Tek Raj Chhetri Code for Humans not for machine.
Unit M Programming Web Pages with
Introduction to Web programming
JQUERY Online TRAINING AT GOLOGICA
14 A Brief Look at JavaScript and jQuery.
JavaScript Introduction
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
Introduction to jQuery
Web Programming Language
E-commerce Applications Development
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

Introduction to jQuery

2 Objectives When you complete this chapter, you will be able to: Select elements using jQuery syntax Use built-in jQuery functions

3 Introduction to jQuery jQuery –Commonly used library –Enables developers to implement common JavaScript tasks with minimal code

4 Implementing jQuery Cross-browser library –jQuery 1.x supports IE 6, 7, and 8 –jQuery 2.x supports only IE 9 and later Requires less extra code, so smaller file

5 Including the Library Link.js file containing library to HTML document –Can download from jquery.com –Can specify public location on CDN

6 Starting a jQuery Statement with $ All jQuery code conforms to JavaScript rules –Uses shortcuts that can look like different language Every jQuery statement begins with $ –Specifies that any code that follows should be interpreted using jQuery library

7 Selecting Elements with jQuery $ followed by reference to elements on which statement operates –Reference contained in parentheses Use CSS selector in quotes to select elements Example–to operate on h1 elements: $("h1") Example—to select elements in odd class: $(".odd") Concise version of querySelectorAll() method: document.querySelectorAll(".odd")

8 Traversing the DOM with jQuery Methods Can select other elements in relation to selection –Use jQuery DOM traversal methods Table 12-1 jQuery methods for DOM traversal

9 Traversing the DOM with jQuery Methods (cont'd.) Select children of original selection: $("ul.mainmenu li").children() Narrow selected items with selector in method's parentheses: $("ul.mainmenu li").children("ul")

10 Manipulating the DOM with jQuery Methods Plain JavaScript –JavaScript without jQuery jQuery API includes methods for performing actions on selected elements

11 Manipulating the DOM with jQuery Methods (cont'd.) Table 12-2 jQuery methods for manipulation

12 Manipulating the DOM with jQuery Methods (cont'd.) Many jQuery methods serve dual function –Look up a value –Set that value 1 $(".odd").width(); 2 /* returns the computed width value for the first 3 element with the class name "odd" */ 4 $(".odd").width("5em"); 5 /* sets the width of all elements with the class name 6 "odd" to 5em */

13 Specifying an Event Handler Can group jQuery statements into functions –Standard JavaScript syntax function display() { $("ul.mainmenu li").children("ul").addClass("show"); }

14 Specifying an Event Handler (cont'd.) Backward-compatible event listener easier in jQuery –Start with $ –Specify selector for element(s) associated with event –Finish with method that specifies event and action(s)

Performs as described with function in () Empty () instead fires indicated event 15 Specifying an Event Handler (cont'd.) Table 12-3 jQuery methods for common events

1 $("form.order").submit(validateForm); 2 /* specifies validateForm() as event handler when form 3 is submitted */ 4 $("form.order").submit(); 5 /* fires submit event on form */ 16 Specifying an Event Handler (cont'd.)

17 Specifying an Event Handler (cont'd.) Table 12-4 jQuery event properties

18 Using jQuery Built-in Effects jQuery includes visual animation methods Table 12-4 jQuery animation methods

19 Using jQuery Built-in Effects (cont'd.) All methods take value in milliseconds as argument –Animation occurs in specified time frame Some also support slow and fast keywords

20 Summary jQuery enables developers to implement common tasks with minimal code Must link.js file containing library to HTML document Every jQuery statement starts with $ Select elements in jQuery with CSS selector in quotes Can modify a selection –Append DOM traversal method to selection code

21 Summary (cont'd.) jQuery API includes methods for performing actions on elements Many methods allow you to look up or set value Event listener consists of –$ –selector –method jQuery includes visual animation methods