Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.

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

CT-376 jQuery Most popular javascript library today Latest version:
JQuery CS 380: Web Programming. What is jQuery? jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling,
JQuery A Javascript Library Hard things made eas(ier) Norman White.
JQuery & SharePoint San Antonio Users Group – September Meeting September 22, 2009 Microsoft SharePoint Server.
CS428 Web Engineering Lecture 15 Introduction to Jquery.
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.
Fundamentals, DOM, Events, AJAX, UI Doncho Minkov Telerik Corporation
Definition from Wikipedia.  The Prototype JavaScript Framework  implemented as a single file of JavaScript code  named prototype.js (
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
M. Taimoor Khan Courtesy: Norman White.
PhpXperts What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.
What is jQuery?  JavaScript Library  Functionality  DOM scripting & event handling  Ajax  User interface effects  Form validation 2.
JQuery March 09 th,2009 Create by
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Lecture 11 – DOM Scripting SFDV3011 – Advanced Web Development Reference: 1.
JQUERY | INTRODUCTION. jQuery  Open source JavaScript library  Simplifies the interactions between  HTML document, or the Document Object Model (DOM),
Interacting with a Web Page using JavaScript Mat Kelly GTAI Presentation January 10, 2014.
13. jQuery See the official documentation at  See the terse API documentation at
ASP.NET Controls. Slide 2 Lecture Overview Identify the types of controls supported by ASP.NET and the differences between them.
JavaScript, Fourth Edition
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 II DOM & JSON. In an effort to create increasingly interactive experiences on the web, programmers wanted access to the functionality of browsers.
JavaScript Frameworks Presented by Kyle Goins Also see:
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.
Telerik Software Academy ASP.NET Web Forms Telerik Software Academy ASP.NET Web Forms.
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.
Lecture 9: AJAX, Javascript review..  AJAX  Synchronous vs. asynchronous browsing.  Refreshing only “part of a page” from a URL.  Frameworks: Prototype,
Session: 1. © Aptech Ltd. 2Introduction to the Web / Session 1  Explain the evolution of HTML  Explain the page structure used by HTML  List the drawbacks.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Fundamentals, Ajax, Templates, UI Doncho Minkov Telerik Corporation
JQuery Introduction © Copyright 2014, Fred McClurg All Rights Reserved.
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.
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.
Web Programming Language Week 9 Dr. Ken Cosh Introducing jQuery.
JQuery Overview Unleash the Power of jQuery SoftUni Team Technical Trainers Software University
Intro to jQuery. What is jQuery? A JavaScript library Lightweight (about 31KB for the minified version) Simplifies HTML document traversing (DOM), event.
1 What is JQuery. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax* interactions.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
Unit 13 –JQuery Basics Instructor: Brent Presley.
Web Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
SHAREPOINT & JQUERY. Hi, my name and I am a product manager at lightning tools. I have been working with SharePoint for 5 years.
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.
05 | Integrating JavaScript and MVC 4 Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek.
JQuery “write less, do more”. jQuery - Introduction Simply a JavaScript library to simplify JavaScript programming itself Wraps long standard JavaScript.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
LECTURE #4: JQUERY AND FORM VALIDATION Josh Kaine Josh Kaine 4/1/2016.
.. WHAT IS JQUERY JQuery is a fast, small, and feature-rich JavaScript library. Simplifies the interaction between HTML and JavaScript. The jQuery library.
MICROSOFT AJAX CDN (CONTENT DELIVERY NETWORK) Make Your ASP.NET site faster to retrieve.
CSCI 3100 Tutorial 5 JavaScript & Ajax Jichuan Zeng Department of Computer Science and Engineering The Chinese University of Hong.
SharePoint & jQuery. About me Phill Duffy – Product Manager at Lightning Tools Ltd – Author of ‘Pro SharePoint with jQuery’ – MCTS Application Developer.
JQuery.
Kendo UI ASP.NET MVC Wrappers
JQuery Fundamentals Introduction Tutorial Videos
Tek Raj Chhetri Code for Humans not for machine.
Unleash the Power of jQuery
Kendo UI ASP.NET MVC Wrappers
CGS 3066: Web Programming and Design Spring 2017
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
Fundamentals, DOM, Events, AJAX, UI
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
..
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Javascript and JQuery SRM DSC.
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Unleash the Power of jQuery Learning & Development Team Telerik Software Academy

 What is jQuery?  jQuery Fundamentals  Selectors  DOM Manipulation  DOM Altering  jQuery DOM elements  AJAX  jQuery AJAX Methods  Executing AJAX Requests 2

The world’s most popular JavaScript library

 jQuery is a cross-browser JavaScript library  jQuery is a cross-browser JavaScript library  Designed to simplify the client-side scripting of HTML  The most popular JavaScript library in use today  Free, open source software  jQuery's syntax is designed to make it easier to  Navigate a document and select DOM elements  Create animations  Handle events 4

 jQuery also provides capabilities for developers to create plugins for  Low-level interaction and animation  Advanced effects and high-level, theme-able widgets  Creation of powerful and dynamic web pages  Microsoft adopted jQuery within Visual Studio  Uses in Microsoft's ASP.NET AJAX Framework and ASP.NET MVC Framework 5

 Easy to learn  Fluent programming style  Easy to extend  You create new jQuery plugins by creating new JavaScript functions  Powerful DOM Selection  Powered by CSS 3.0  Lightweight  Community Support  Large community of developers and geeks 6

 Download jQuery files from   Self hosted  You can choose to self host the.js file  E.g. jquery js or.min.js file  Use it from CDN (content delivery network)  Microsoft, jQuery, Google CDNs  e.g.  min.js min.js min.js 7

 Selection of DOM elements in jQuery is much like as in pure JavaScript  Selection of elements using CSS selectors  Like querySelectorAll $(selector) //by tag $("div") //document.querySelectorAll("div"); //by class $(".menu-item")//document.querySelectorAll(".menu-item"); //by id $("#navigation") //by combination of selectors $("ul.menu li")

 Selecting items with jQuery  Almost always returns a collection of the items  Even if there is only one item  Can be stored in a variable or used right away  The usage of the elements is always the same, no matter whether a single or many elements  More at: core/selecting-elements/ core/selecting-elements/ core/selecting-elements/ // select the item $("#something").hide();$(".widgets").fade(1); 10

Live Demo

Traversing the nodes of the DOM

 As with plain JavaScript, the DOM can be traversed with jQuery  Properties for:  Next and previous siblings  Parents and children

 jQuery.next(), jQuery.prev()  Returns the next/prev sibling  Returns an HTML element  Not a [text] node <ul> Item 1 Item 1 Item 2 Item 2 Item 3 Item 3 </ul> var $first = $("li").first(); log($first); //logs "Item 1" log($first.next()); //logs "Item 2"

Live Demo

 jQuery.parent()  Returns the parent of the element  jQuery.parents(selector)  Returns the first parent that matches the selector Item 1 Item 1 Item 2 Item 2 Item 3 Item 3 Item 4 Item 4 </div> var $node = $(".special"); $node.parent().attr("id"); //logs "items-list" $node.parents("div").attr("id"); //logs "wrapper" $node.parents("#wrapper").attr("id"); /logs "wrapper"

Live Demo 17

Adding and removing DOM elements

 Adding elements can  be done on the fly  jQuery.appendTo() / prependTo()  jQuery.append() / prepend() $('<ul><li>Hello</li></ul>').appendTo('body');$("body").prepend("<h1>header</h1>"); 19

 Creating new elements is also easy var $divElement = $(' '); var $anotherDivElement = $(' '); 20

Live Demo 21

// Before <div> Red Red Green Green </div> // Removing elements $('p').remove(); 22  You can also remove elements from the DOM  Just as easy // After <div></div>

Live Demo

 Selected with jQuery DOM elements are NOT pure DOM elements  They are extended  Have additional properties and methods  addClass(), removeClass(), toogleClass()  on(event, callback) for attaching events  animate(), fade(), etc… //Parsing a regular DOM element to jQuery Element var content = document.createElement("div"); var $content = $(content);

 jQuery elements extend regular DOM elements  Methods for altering the elements  jQuery.css("color", "#f3f")  jQuery.html() returns the innerHTML  jQuery.html(content) sets the innerHTML  jQuery.text(content) sets the innerHTML, by escaping the content 26

Live Demo

Cross-browser events

 jQuery has a convenient way for attaching and detaching events  Works cross-browser  Using methods on() and off() function onButtonClick(){ $(".selected").removeClass("selected"); $(".selected").removeClass("selected"); $(this).addClass("selected"); $(this).addClass("selected");} $("a.button").on("click", onButtonClick); 29

 Optimize the event  Add it on the parent element  A bit different syntax function onListItemClick(){ $(".selected").removeClass("selected"); $(".selected").removeClass("selected"); $(this).addClass("selected"); $(this).addClass("selected");} $("ul").on("click", "li", onListItemClick); 30

Live Demo 31

Call after call, after call… 32

 The chaining paradigm is as follows:  If a method should return result -> Ok, return it  If a method should NOT return a result -> return this  jQuery implements this paradigm, so methods can be chained to one another: $(' ').addClass('btn-success').addClass('btn-success').html('Click me for success').html('Click me for success').on('click', onSuccessButtonClick).on('click', onSuccessButtonClick).appendTo(document.body);.appendTo(document.body);

Live Demo 34

Creating HTTP requests with jQuery

 AJAX stands for Asynchronous JavaScript and XML  Meaning asynchronously get data from a remote place and render it dynamically  jQuery provides some methods for AJAX  jQuery.ajax(options) – HTTP request with full control (headers, data, method, etc…)  jQuery.get(url) – HTTP GET request  jQuery.post(url) – HTTP POST request  jQuery(selector).load(url) – loads the contents from the url inside the selected node

Live Demo

Questions?

1. Create a slider control using jQuery  The slider can have many slides  Only one slide is visible at a time  Each slide contains HTML code  i.e. it can contain images, forms, divs, headers, links, etc…  Implement functionality for changing the visible slide after 5 seconds  Create buttons for next and previous slide 39

2. Using jQuery implement functionality to insert a DOM element before or after another element 3. By given an array of students, generate a table that represents these students  Each student has first name, last name and grade  Use jQuery 4. Implement functionality to change the background color of a web page  i.e. select a color from a color picker and set this color as the background color of the page 40

5. *Implement a GridView control  Rows can be added dynamically  A header row can be added dynamically  Each GridView can have at most one header row  Each row can have a nested GridView  Each GridView can have at most one nested GridView 41

 "Web Design with HTML 5, CSS 3 and JavaScript" Telerik Academy  html5course.telerik.com html5course.telerik.com  Telerik Software Academy  academy.telerik.com academy.telerik.com  Telerik Facebook  facebook.com/TelerikAcademy facebook.com/TelerikAcademy  Telerik Software Academy Forums  forums.academy.telerik.com forums.academy.telerik.com