Unit 13 –JQuery Basics Instructor: Brent Presley.

Slides:



Advertisements
Similar presentations
JavaScript & jQuery JavaScript and jQuery introduction.
Advertisements

JQuery CS 380: Web Programming. What is jQuery? jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling,
Lesson 12- Unit L Programming Web Pages with JavaScript.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
JQuery. What is jQuery? jQuery is a fast, small, and feature-rich JavaScript library that simplifies HTML document traversing and manipulation event handling.
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 (
JQuery CS 268. What is jQuery? From their web site:
PhpXperts What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.
Nguyen Ich Cuong.  Course duration: 45’  Purpose: Present Introduction to JQuery  Targeted attendees: NICorp Trainee  Tests/quiz: Yes - 10’
What is jQuery?  JavaScript Library  Functionality  DOM scripting & event handling  Ajax  User interface effects  Form validation 2.
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.
Lecture 11 – DOM Scripting SFDV3011 – Advanced Web Development Reference: 1.
JQuery Adding behaviour…. Lecture Plan Review of last lesson Adding behaviour –click, mouseover Animation –fade, slideDown Navigation –parent, find, next.
JQUERY | INTRODUCTION. jQuery  Open source JavaScript library  Simplifies the interactions between  HTML document, or the Document Object Model (DOM),
Review IDIA 619 Spring 2013 Bridget M. Blodgett. HTML A basic HTML document looks like this: Sample page Sample page This is a simple sample. HTML user.
13. jQuery See the official documentation at  See the terse API documentation at
JavaScript, Fourth Edition
© 2012, Mike Murach & Associates, Inc.
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.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Javascript II DOM & JSON. In an effort to create increasingly interactive experiences on the web, programmers wanted access to the functionality of browsers.
Conor Russomanno & Elizabeth Umbrino. A popular free Javascript Library Released in January 2006 At BarCamp, an international network of user-generated.
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
JQuery Javascript Library. JQuery Powerful JavaScript library –Simplify common JavaScript tasks –Access parts of a page using CSS or XPath-like expressions.
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.
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.
Creating Dynamic Webpages
Intro to jQuery. What is jQuery? A JavaScript library Lightweight (about 31KB for the minified version) Simplifies HTML document traversing (DOM), event.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
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.
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.
SHAREPOINT & JQUERY. Hi, my name and I am a product manager at lightning tools. I have been working with SharePoint for 5 years.
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
CHAPTER 7 JQUERY WHAT IS JQUERY? jQuery is a script. It is written in JavaScript.
JQUERY AND AJAX
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
LECTURE #4: JQUERY AND FORM VALIDATION Josh Kaine Josh Kaine 4/1/2016.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
.. WHAT IS JQUERY JQuery is a fast, small, and feature-rich JavaScript library. Simplifies the interaction between HTML and JavaScript. The jQuery library.
Shaun Geisert Matt Trice. What is jQuery?  Open source Javascript library/framework Created by John Resig  Their tagline – “The Write Less, Do More.
JQuery is a fast, small, and feature-rich javascript library. It makes things like HTML document traversal and manipulation, event handling, animation,
JQuery.
JQuery Fundamentals Introduction Tutorial Videos
What is jQuery?.
Introduction to.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Unit M Programming Web Pages with
Tek Raj Chhetri Code for Humans not for machine.
Unit M Programming Web Pages with
CGS 3066: Web Programming and Design Spring 2017
JQuery.
JQUERY Online TRAINING AT GOLOGICA
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
..
Javascript and JQuery SRM DSC.
Document Object Model.
Web Client Side Technologies Raneem Qaddoura
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

Unit 13 –JQuery Basics Instructor: Brent Presley

WHAT IS JQUERY? jQuery is a library, or set of helpful add-ons, to the JavaScript programming language. It may seem counterintuitive to learn how to use a library before learning the actual language, but there are a few good reasons for this.

WHAT DOES JQUERY DO? What jQuery does best is to interact with the DOM (add, modify, remove elements on your page), do AJAX requests, create effects (animations) and so forth work with modern browser event model adds sophisticated effects

WHY IS JQUERY HELPFUL? Tested for cross-browser compatibility Useful for: – Special effects and animations – Customizing forms – DOM manipulation – jQuery UI (user interface) – Another library that uses the core jQuery library as its core (more jQuery built on jQuery) Libraries are called plugins

BENEFITS OF USING JQUERY leverages knowledge of css works with sets of elements perform multiple operations on a set of elements with one line of code (statement chaining) hides browser quirks (so you can concentrate on the end result) is extensible( so you can use 3rd party plugins)

JQUERY LIBRARIES INCLUDE * Data validation plugins * Slide show plugins * Carousel plugins

GETTING JQUERY open source can download file * Better to simply link it into the pages that need it Compressed version is very small. Shouldn’t affect page load much.

LINK TO IT VS DOWNLOAD? > Ensures you’re always including the most recent version > Include in header.php? Maybe better to include in individual views that use it. > Have to have an Internet connection to test pages, but that shouldn’t be a big problem. > See book for how to include latest version offline.

JQUERY BASICS * Debugging: Firebug may report errors in jQuery files, but it’s never the jQuery files it’s the calls you made to jQuery libraries. Check the calls. * Combines JavaScript IDs with CSS tags to reference page elements

JQUERY METHODS * $(document).ready(function() { }); > Used in most JavaScript pages Replaces window.onload—actually more efficient (Murach) Note document not in quotes—fixed name for the entire document So commonly used, there’s a short form: $(function() { } ); * Document.ready is assumed here

JQUERY SELECTORS AND FILTERS retrieve content from the document so it can be manipulated using other functions returns array of objects that match the criteria filter acts on a selector to further refine the results array that the selector returns. the array is not a set of DOM elements it is a collection of JQuery objects that have predefined functions included with them

USING JQUERY SELECTORS css-style selectors and filters are based on css syntax.

Sample and Comparison

HEIRARCHY AND COMBINATION SELECTORS heirarchy and combination selectors allow a bit more advanced selecting

JQUERY FILTERING basic -first, last, etc content - contains a particular string visibility - use visibility of each element as test attribute- examines a given attribute child -select elements based on relationship with their parent element form - operates on form elements - enabled, checked, etc

OTHER FILTER OPTIONS

ATTRIBUTE FILTERS

ATTRIBUTE FILTER EXAMPLES

CHILD FILTERS

TRAVERSING THE DOCUMENT INFORMATION

EXAMPLES returns the number of items in the collection of labels alert of obj type of first label

JQUERY RESOURCES basics.htmhttp:// basics.htm

JQUERY METHODS * Like JavaScript functions, jQuery methods must be associated with an event Generic format: $(selector).event(function() { //code here }); Note that this event handler includes an anonymous function. The function has no name, but is linked to the event. Similar to anonymous functions in Android.

* $("#btnSubmit").click(function() { alert("Button clicked! "); }); Code for the click event of button with this ID Define btnSubmit click Just show an alert Like in JavaScript, event handlers for buttons, etc. are usually defined in the ready function

LINK EVENT HANDLER TO FUNCTION linking the event handler to another function (other than calling that function) $(function() { //Ready $("#btnSubmit").click(function() { alert("Button clicked! "); }); //end of click }); //end of ready Indentation is critical – Keep all the { } and ( ) straight

*.show().hide() > Show or hide selector > Easier than using css(‘visibility’)

SELECTORS * Selectors allow you to designate which page (form) objects to apply code to. Similar to the $( ) function we wrote in JavaScript to access form elements quickly. Selectors start with $( ) (like our function)

USING CSS SELECTORS * Instead of just the name (id) of a page element, jQuery selector allows you to use any CSS selector (in quotes) to designate page elements One jQuery selector can select many page elements (unlike our $ function that only referenced one)

EXAMPLE * Examples: > $("p") applies jQuery code to all paragraphs > $("#header") applies jQuery code to the page element with ID header similar to our $ function but note the # is required $(".title") applies jQuery to all elements with class title

ACCESSING VALUES, ATTRIBUTES, AND CSS * (selector).val * (selector).attr(‘attribute’, value) * (selector).css(‘style’, ‘newvalue’)

JAVASCRIPT EASIER * Rename our $ to $$ or el * No easy jQuery way to clear form

FUNCTION CHAINING one of JQuery's most powerful features is the ability to chain multiple functions output from the first function is the input to the second...