PhpXperts - 09. What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.

Slides:



Advertisements
Similar presentations
Diego Guidi - DotNetMarche. DOM tree is clunky to use No multiple handlers per event No high-level functions Browser incompatibilities = jQuery to the.
Advertisements

JavaScript – Quiz #8 Lecture Code:
Getting Started with jQuery. 1. Introduction to jQuery 2. Selection and DOM manipulation Contents 2.
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,
Programming Club IIT Kanpur. Work environment Before you begin coding,always set up your work environment to your needs IDE Notepad++ Sublime Text 2.
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.
Building a Rich Internet Application with jQuery Ben Dewey twentysix New York Fill this space.
School of Computing and Information Systems CS 371 Web Application Programming jQuery.
Vishal Kumar 06131A1258. Why you’re going to love jQuery!
CS428 Web Engineering Lecture 15 Introduction to Jquery.
ICS 665 Jesse Abdul. jQuery UI Overview  jQuery UI javascript library Includes all UI component functionality  jQuery UI CSS framework Includes standard.
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)
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 (
JQuery CS 268. What is jQuery? From their web site:
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 March 09 th,2009 Create by
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
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),
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.
JQuery Fairway Code Brew. Agenda What is jQuery? No, really, what is it? Show me something cool Why should I use it? Disturbing photo More features FlexBox.
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.
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 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.
LOGO sparcs.org 1 jQuery Tutorial Presenter ㅎㅇㅎㅇ.
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
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.
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.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
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.
SharePoint & jQuery. About me Phill Duffy – Product Manager at Lightning Tools Ltd – Author of ‘Pro SharePoint with jQuery’ – MCTS Application Developer.
JQuery is a fast, small, and feature-rich javascript library. It makes things like HTML document traversal and manipulation, event handling, animation,
JQuery.
What is jQuery?.
Vinay Vasyani Internet Programming
12/04/12 JQuery I took these slides from the site because they were pretty good looking. Instructions for editing school and department titles: Select.
Tek Raj Chhetri Code for Humans not for machine.
Unleash the Power of jQuery
CGS 3066: Web Programming and Design Spring 2017
Introduction to Web programming
JQUERY Online TRAINING AT GOLOGICA
Fundamentals, DOM, Events, AJAX, UI
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
Introduction to jQuery
Web Programming Language
..
E-commerce Applications Development
Presentation transcript:

phpXperts - 09

What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript

phpXperts - 09 Why jQuery? Lightweight : 19KB in size (Minified and Gzipped) CSS1 - 3 Complaint Cross Browser  (IE 6.0+, FF 2+, Safari 3.0+, Opera 9.0+, Chrome)

phpXperts - 09 Why jQuery? Lightweight : 19KB in size (Minified and Gzipped) CSS1 - 3 Complaint Cross Browser  (IE 6.0+, FF 2+, Safari 3.0+, Opera 9.0+, Chrome) Great Community Plugins Tutorials TestCoverage Open (free) license Books

phpXperts - 09 A ajax and DOM manipulation example if (!document.ELEMENT_NODE) { document.ELEMENT_NODE = 1; document.ATTRIBUTE_NODE = 2; document.TEXT_NODE = 3; document.CDATA_SECTION_NODE = 4; document.ENTITY_REFERENCE_NODE = 5; document.ENTITY_NODE = 6; document.PROCESSING_INSTRUCTION_NODE = 7; document.COMMENT_NODE = 8; document.DOCUMENT_NODE = 9; document.DOCUMENT_TYPE_NODE = 10; document.DOCUMENT_FRAGMENT_NODE = 11; document.NOTATION_NODE = 12; } document._importNode = function(node, allChildren) { switch (node.nodeType) { case document.ELEMENT_NODE: var newNode = document.createElement(node ».nodeName); /* does the node have any attributes to add? */ if (node.attributes && node.attributes ».length > 0) for (var i = 0; il = node.attributes.length; » i 0) for (var i = 0; il = node.childNodes.length; » i < il) newNode.appendChild(document._importNode » (node.childNodes[i++], allChildren)); return newNode; break; case document.TEXT_NODE: case document.CDATA_SECTION_NODE: case document.COMMENT_NODE: return document.createTextNode(node.nodeValue); break; } };

phpXperts - 09 It’s just a single line in jQuery $(“#content”).load(“page.html #content”);

phpXperts - 09 Who’s using jQuery?

phpXperts - 09 Dominating the world Google trends comparison of last JS framework 12 months eo=all&date=ytd&sort=0

phpXperts - 09 Let’s Start Download jQuery

phpXperts - 09 Embed in you page …

phpXperts - 09 Embed in you page $(document).ready(function(){ // Start here }); …

phpXperts - 09 $(“div”).addClass(“xyz”); Find Some Elements Do something with them { } jQuery Object jQuery philosophy

phpXperts - 09 A Basic Example I m a paragraph 1 I m a paragraph 2 I m another paragraph

phpXperts - 09 A Basic Example I m a paragraph 1 I m a paragraph 2 I m another paragraph Select all paragraphs. $(“p”)

phpXperts - 09 A Basic Example I m a paragraph -1 I m a paragraph -2 I m another paragraph Select all paragraphs. Add a class to them. $(“p”).addClass(“red”);

phpXperts - 09 Selector Basics Just pass a selector to $() What is selector? Use any CSS selector

phpXperts - 09 Selector Basics Think about your simplest css file. #header{ margin : 0 auto; } div{ margin : 0px; padding : 0px } ul.menu li{ ….. }

phpXperts - 09 Selector Basics The red colored items are selectors #header{ margin : 0 auto; } div{ margin : 0px; padding : 0px } ul.menu li{ ….. }

phpXperts - 09 Selector Basics Selecting By Id  $(“#header”) Selecting using selectors

phpXperts - 09 Selector Basics Selecting By Id  $(“#header”) Selecting By Class  $(“.updated”) Selecting using selectors

phpXperts - 09 Selector Basics Selecting By Id  $(“#header”) Selecting By Class  $(“.updated”) Selecting by tag name  $(“table”) Selecting using selectors

phpXperts - 09 Selector Basics Selecting By Id  $(“#header”) Selecting By Class  $(“.updated”) Selecting by tag name  $(“table”) Combine them  $(“table.user-list”)  $(“#footer ul.menu li”) Selecting using selectors

phpXperts - 09 Basic Selector Example This is my page Logo here… user name ….. logout ……

phpXperts - 09 Basic Selector Example $(“#header”) Logo here… user name ….. logout ……

phpXperts - 09 Basic Selector Example $(“ul.menu”) Logo here… user name ….. logout ……

phpXperts - 09 Basic Selector Example $(“ul.menu li”) Logo here… user name ….. logout ……

phpXperts - 09 Using filters for selecting Basic Filters  :first, :last, :even, :odd, …...

phpXperts - 09 Basic Filters Example NameClassRoll No.Comment RajuXII2Good MasudIX1Good ApuXII3 MizanXII5 KarimVI2Satisfactory Student list table. Lets make it zebra.

phpXperts - 09 Basic Filters Example NameClassRoll No.Comment RajuXII2Good MasudIX1Good ApuXII3 MizanXII5 KarimVI2Satisfactory $(“#students tr:even”).css(“background-color”, “#dde”)

phpXperts - 09 Using filters for selecting Basic Filters  :first, :last, :even, :odd, …... Content Filters:  :empty, :contains(text), :has(selector), …..

phpXperts - 09 Content Filters Example NameClassRoll No.Comment RajuXII2Good MasudIX1Good ApuXII3No Comment MizanXII5No Comment KarimVI2Satisfactory $(“#students tr:even”).css(“background-color”, “#dde”); $(“#students td.comment:empty”).text(“No Comment”);

phpXperts - 09 Using filters for selecting Basic Filters  :first, :last, :even, :odd, …... Content Filters:  :empty, :contains(text), :has(selector), ….. Attribute Filters:  [attribute], [attribute=value], [attribute!=value], …..

phpXperts - 09 Attribute Filters Example NameClassRoll No.Comment RajuXII2Good MasudIX1Good ApuXII3No Comment MizanXII5No Comment KarimVI2Satisfactory $(“#students tr:even”).css(“background-color”, “#dde”); $(“#students td.comment:empty”).text(“No Comment”); $(“#students td[align=‘center']").addClass(“ocean”);

phpXperts - 09 Using filters for selecting Basic Filters  :first, :last, :even, :odd, …... Content Filters:  :empty, :contains(text), :has(selector), ….. Attribute Filters:  [attribute], [attribute=value], [attribute!=value], ….. Forms  :input, :text, :submit, :password, …..  :enabled, :disabled, :checked, …..

phpXperts - 09 Forms Selector Example $(":submit").click(function(e){ … }); $("input:disabled").val(“You cannot change me"); $(“#form-id input:checked”).addClass(“selected”);

phpXperts - 09 Now we can Select Let’s perform some action

phpXperts - 09 jQuery Methods DOM Manipulation  before(), after(), append(), appendTo(), …..

phpXperts - 09 Dom Manipulation Example Move all paragraphs in div with id “contents” $(“p”) jQuery jQuery is good jQuery is better jQuery is the best

phpXperts - 09 Dom Manipulation Example Move all paragraphs in div with id “contents” $(“p”).appendTo(“#contents”); jQuery jQuery is good jQuery is better jQuery is the best

phpXperts - 09 Dom Manipulation Example Move all paragraphs in div with id “contents” $(“p”).appendTo(“#contents”); $(“h1”).append(“ Dom Manipulation”); jQuery Dom Manipulation jQuery is good jQuery is better jQuery is the best

phpXperts - 09 jQuery Methods DOM Manipulation  before(), after(), append(), appendTo(), ….. Attributes  css(), addClass(), attr(), html(), val(), …..

phpXperts - 09 Attributes Example Make the texts of last paragraph bold $(“#contents p:last”).css(“color”, “green”); jQuery Dom Manipulation jQuery is good jQuery is better jQuery is the best

phpXperts - 09 More Attributes Example Setting $(“img.logo”).attr(“align”, “left”); $(“p.copyright”).html(“© 2009 ajaxray”); $(“input#name”).val(“Spiderman”);

phpXperts - 09 More Attributes Example Setting $(“img.logo”).attr(“align”, “left”); $(“p.copyright”).html(“© 2009 ajaxray”); $(“input#name”).val(“Spiderman”); Getting var allignment = $(“img.logo”).attr(“align”); var copyright = $(“p.copyright”).html(); var username = $(“input#name”).val();

phpXperts - 09 jQuery Methods DOM Manipulation  before(), after(), append(), appendTo(), ….. Attributes  css(), addClass(), attr(), html(), val(), ….. Events  click(), bind(), unbind(), live(), …..

phpXperts - 09 Event Example Start when DOM is ready $(document).ready(function(){ $(selector).eventName(function(){…}); });

phpXperts - 09 Event Example Bind all interactions on events. $(document).ready(function(){ $(“#message”).click(function(){ $(this).hide(); }) }); blah blah

phpXperts - 09 Event Example You can fire events manually. $(document).ready(function(){ $(“span#message”).click(function(){ $(this).hide(); }) $(“#form-id:reset”).click(); });

phpXperts - 09 jQuery Methods DOM Manipulation  before(), after(), append(), appendTo(), ….. Attributes  css(), addClass(), attr(), html(), val(), ….. Events  click(), bind(), unbind(), live(), ….. Effects  hide(), fadeOut(), toggle(), animate(), …..

phpXperts - 09 Effects Example When “show-cart” link clicked, slide up/down “cart” div. $(“a#show-cart”).click(function(){ $(“#cart”).slideToggle(“slow”); })

phpXperts - 09 Effects Example Build your custom animation $(“a#show-cart”).click(function(){ $(“#cart”).slideToggle(“slow”); }) $("#showdown").click(function(){ $("#my-div").animate({ width: "70%", opacity: 0.4, fontSize: "3em“ }, 1200 ); });

phpXperts - 09 jQuery Methods DOM Manipulation  before(), after(), append(), appendTo(), ….. Attributes  css(), addClass(), attr(), html(), val(), ….. Events  click(), bind(), unbind(), live(), ….. Effects  hide(), fadeOut(), toggle(), animate(), ….. Ajax  load(), get(), ajax(), getJSON(), …..

phpXperts - 09 Ajax Examples Load a page in a container $(“#comments”).load(“/get_comments.php”); $(“#comments”).load(“/get_comments.php”, {max : 5});

phpXperts - 09 Ajax Examples Send ajax request with data $.get(“/edit_comment.php", {id: 102, comment: “I m edited"} );

phpXperts - 09 Ajax Examples You can send serialized form as data $.get(“/edit_comment.php", $(“#edit-comment”).serialize() ); id=102&comment=I+m+edited

phpXperts - 09 Ajax Examples Set a callback function for handling response data $.get(“edit_comment.php", $(“form#cmm-edit”).serialize(), function(data){ if(data == “success”) alert(“Comment Edited!”); } );

phpXperts - 09 Chaining Methods Most jQuery methods return jQuery object You can chain them together

phpXperts - 09 Chaining Methods Most jQuery methods return jQuery object You can chain them together $(“#deleted”).addClass(“red”).fadeOut(“slow”); $(“:button”).val(“Click Me”).click(function(){…})

phpXperts - 09 Chaining Methods Most jQuery methods return jQuery object You can chain them together $(“#deleted”).addClass(“red”).fadeOut(“slow”); $(“:button”).val(“Click Me”).click(function(){…}) This will not work - $(“:button”).val().click(function(){…}) This method will return string

phpXperts - 09 jQuery Plugins jQuery is extensible.

phpXperts - 09 jQuery Plugins jQuery lightBox

phpXperts - 09 jQuery Plugins Slider Plugins

phpXperts - 09 And thousands of more…

phpXperts - 09 jQuery UI Build highly interactive web applications

phpXperts - 09 jQuery UI – Interactions (Draggale, Droppable, Resizable, Selectable, Sortable)

phpXperts - 09 jQuery UI – Sortable Example $("#items").sortable();

phpXperts - 09 jQuery UI – Widgets (Accordion, Datepicker, Dialog, Progressbar, Slider, Tabs)

phpXperts - 09 jQuery UI – Datepicker Example $("#date").datepicker();

phpXperts - 09 Which one will match your site?

phpXperts - 09 Designing a jQuery UI theme - Themeroller

phpXperts - 09 Questions?

THANK YOU