Nguyen Ich Cuong.  Course duration: 45’  Purpose: Present Introduction to JQuery  Targeted attendees: NICorp Trainee  Tests/quiz: Yes - 10’

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 A Javascript Library Hard things made eas(ier) Norman White.
Building a Rich Internet Application with jQuery Ben Dewey twentysix New York Fill this space.
JQUERY/AJAX ALIREZA KHATAMIAN DELARAM YAZDANSEPAS.
Computer Information System Information System California State University Los Angeles Jongwook Woo CIS 461 Web Development I JQuery Part I Jongwook Woo,
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
Presented at NCDevCon 2011 by: Denard Springle. Freelance Software Systems Engineer Rich internet and mobile applications Hardware, network and storage.
Definition from Wikipedia.  The Prototype JavaScript Framework  implemented as a single file of JavaScript code  named prototype.js (
CS 174: Web Programming April 9 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
M. Taimoor Khan Courtesy: Norman White.
PhpXperts What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.
JavaScript, jQuery & AJAX. What is JavaScript? An interpreted programming language with object oriented capabilities. Not Java! –Originally called LiveScript,
What is jQuery?  JavaScript Library  Functionality  DOM scripting & event handling  Ajax  User interface effects  Form validation 2.
Yahoo! User Interface (YUI) Library Natly Mekdara.
JQuery March 09 th,2009 Create by
JQuery Adding behaviour…. Lecture Plan Review of last lesson Adding behaviour –click, mouseover Animation –fade, slideDown Navigation –parent, find, next.
13. jQuery See the official documentation at  See the terse API documentation at
Jquery Nasrullah. Jquery jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn.
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.
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.
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.
CHAPTER 5 jQuery อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Fundamentals, Ajax, Templates, UI Doncho Minkov Telerik Corporation
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.
Browser scripting jQuery Edited by: Trần Thị Mỹ Dung Ref:w3schools.com.
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.
Web Programming Language Week 9 Dr. Ken Cosh Introducing jQuery.
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
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.
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.
KAPITA SELEKTA INFORMATIKA Lasmedi Afuan, ST.M.Cs.
Selectors & Events. What do Selectors do? What do Selectors do? Selectors allow you to manipulate DOM elements as a group or as a single node. This allows.
CS 174: Web Programming October 28 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
JQuery Tutorial. What is jQuery jQuery is a JavaScript Library The purpose of jQuery is to make it much easier to use JavaScript on your website JavaScript.
Mobile Web Design Best Practices Three Approaches to Mobile Web: ◦ Develop a new mobile site with a.mobi TLD ◦ Create a separate website hosted within.
JQuery is a fast, small, and feature-rich javascript library. It makes things like HTML document traversal and manipulation, event handling, animation,
JQuery Element & Attribute Selectors, Events, HTML Manipulation, & CSS Manipulation.
JQuery.
What is jQuery?.
Vinay Vasyani Internet Programming
-By Yogita Nirmal.
Tek Raj Chhetri Code for Humans not for machine.
jQuery A Javascript Library Hard things made eas(ier)
Introduction to Web programming
JQuery Basics 소속 / 작성자 이 문서는 나눔글꼴로 작성되었습니다. 설치하기.
JQuery.
JQUERY Online TRAINING AT GOLOGICA
Fundamentals, DOM, Events, AJAX, UI
The Cliff Notes Version
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
jQuery A Javascript Library Hard things made eas(ier)
Web Programming Language
..
E-commerce Applications Development
Document Object Model.
Web Programming Language
JQuery.
Presentation transcript:

Nguyen Ich Cuong

 Course duration: 45’  Purpose: Present Introduction to JQuery  Targeted attendees: NICorp Trainee  Tests/quiz: Yes - 10’

 After the course, trainee will be able to:  Understand JQuery

 JQuery  JQuery Syntax

 A library of JavaScript Functions.  JQuery simplifies event handling  JQuery provides many build-in animation effects  The jQuery library contains the following features:  HTML element selections  HTML element manipulation  CSS manipulation  HTML event functions  JavaScript Effects and animations  HTML DOM traversal and modification  AJAX  Utilities

 Cross Browser support  JavaScript Animation  AJAX Functions  Hundreds of plug-ins for pre-built user interfaces, advanced animation and form validation etc …  CSS functions  DOM Manipulation  DOM Traversing  Expandable using custom plug-ins  Attribute Manipulation  Event detection and handling  Small footprint

 A single JavaScript file, containing all the jQuery methods.  Add the following code into your html/jsp page and call the jQuery APIs.  For Example $(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); This is a heading This is a paragraph. This is another paragraph. Click me

 In order to use jQuery you need to load it  You can include it locally on your own server:   Or use one of the CDNs made available:  ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js  ajax.microsoft.com/ajax/jquery/jquery js  CDNs are Gzipped and minified

 With jQuery you select (query) HTML elements and perform "actions" on them.  jQuery Syntax Examples  $(this).hide()  $("#test").hide()  $("p").hide()  $(".test").hide()  Basic syntax is: $(selector).action()  A dollar sign to define jQuery  A (selector) to "query (or find)" HTML elements  A jQuery action() to be performed on the element(s)

 To select HTML elements (or groups of elements) by element name, attribute name or by content.  jQuery Element Selectors  Uses CSS selectors to select HTML elements.  $("p“)  $("p.intro“)  $("p#demo“)  jQuery Attribute Selectors  jQuery uses XPath expressions to select elements with given attributes.  $("[href ]“)  $("[href=#]")  $("[href!=#]“).  $("[href$=.jpg]“)

 jQuery CSS Selectors  jQuery CSS selectors can be used to change CSS properties for HTML elements.  For Ex:  $("p").css("background-color","yellow");  Few samples for the selectors SyntaxDescription $(this)Current HTML element $("p")All elements $("p.intro")All elements with class="intro" $(".intro")All elements with class="intro" $("#intro")The first element with id="intro" $("ul li:first")The first element of each $("[href$=.jpg]")All elements with an href attribute that ends with ".jpg" $("div#intro.head")All elements with class="head" inside a element with id="intro"

 All standard CSS selectors work - If you know CSS, you can work with jQuery  CSS 3 is fully supported  Additional CSS style selectors (not standard CSS selectors)  :contains()  :disabled  :first  :last  :odd  :even  And many more…

 First paragraph - p:first  Last list item - li:last  Fourth link - a:nth(3)  Fourth Div - div:eq(3)  Every other Paragraph - p:odd or p:even  Every link after/upto 4th - a:gt(3) or a:lt(4)  Links that contain word like click - a:contains(“click”)  All radio inputs with in first form - $(“input:radio”, documents.forms[0])

 Read  $(#image).attr(“src”);  Set  $(#image).attr(“src”, “images/jquery1.jpg”);  Multiple Set  $(#image).attr({src: “images/jquery1.jpg”, alt: “jQuery”});  Set Class  $(p:last).addClass(“selected”);  Read/Set Html  $(#id).html() & $(#id).html(“value”);

 The jQuery event handling methods are core functions in jQuery.  For Example $(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); This is a heading This is a paragraph. This is another paragraph. Click me

.bind(“eventName”, function (event) { }) .unbind(“eventName”) .live(“eventName”, function (event) { }) .die(“eventName”)  Named Events  Callbacks

 A callback function is executed after the current animation (effect) is finished.  Syntax  $(selector).hide(speed,callback)  For Ex:  $("p").hide(1000,function(){ alert("The paragraph is now hidden"); });

.hide() or.show() .fadeIn() or.fadeOut() .slideDown() or.slideUp() .animate()  Callbacks

 jQuery can manipulate the HTML elements and attributes  Changing HTML Content  $(selector).html(content)  Adding HTML content  $(selector).append(content)  $(selector).prepend(content)  $(selector).after(content)  $(selector).before(content)  jQuery HTML Manipulation Methods FunctionDescription $(selector).html(content)Changes the (inner) HTML of selected elements $(selector).append(content)Appends content to the (inner) HTML of selected elements $(selector).after(content)Adds HTML after selected elements

 jQuery css() Method  css(name) - Return CSS property value  css(name,value) - Set CSS property and value  css({properties}) - Set multiple CSS properties and values  Examples  Return CSS Property  $(this).css("background-color");  Set CSS Property & value  $("p").css("background-color"," yellow");  Set Multiple values in CSS  $("p").css({"background-color":"yellow","font-size":"200%"});  Size Manipulation  $("#div1").height("200px"); $("#div2").width("300px");

 Offset  $(this).offset().left  $(this).offset().top  jQuery CSS Manipulation Methods  Position  $(this).position().left  $(this).position().top CSS PropertiesDescription $(selector).css(name)Get the style property value of the first matched element $(selector).css(name,value)Set the value of one style property for matched elements $(selector).css({properties})Set multiple style properties for matched elements $(selector).height(value)Set the height of matched elements $(selector).width(value)Set the width of matched elements

 Walkthrough: Open the jquery.plugin.template.js file in the provided sample project  Uses the self-invoking function pattern  Use a method array to avoid polluting the jQuery.fn namespace  Context in jQuery Plugins  Using jQuery’s data method to keep track of variables  Calling methods on the plugin  Cautions with 3rd party plugins

 Basic pattern: $.ajax({ url: url, type: “GET”, success: function (data, status, xhr) { //Do something here }, error: function (request, status, error) { //Something bad happened here }, dataType: “json“ });  Additional options

 Contains a number of full featured widgets  Accordion, Autocomplete, Button, Datepicker, Dialog, Progressbar, Slider, and Tabs  Also contains more complex interactions  Draggable, Droppable, Resizable, Selectable, Sortable  Completely stylable  When to use jQuery UI?

 jQuery slideshow by mishraDileep.com   