JQuery March 09 th,2009 Create by

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.
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
Building a Rich Internet Application with jQuery Ben Dewey twentysix New York Fill this space.
JQUERY/AJAX ALIREZA KHATAMIAN DELARAM YAZDANSEPAS.
School of Computing and Information Systems CS 371 Web Application Programming jQuery.
© 2007 IBM Corporation IBM Emerging Technologies Enabling an Accessible Web 2.0 Becky Gibson Web Accessibility Architect.
Ajax Dr Jim Briggs WEBP Ajax1. 2 Ajax Asynchronous JavaScript And XML Method of creating more interactive web applications Moves more of the application.
Vishal Kumar 06131A1258. Why you’re going to love jQuery!
-Uday Dhokale.  What is it ??? Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.  Features a unique, easy-to-use.
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 (
Getting Started.  jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions.
M. Taimoor Khan Courtesy: Norman White.
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.
By Jon Marozick.  JavaScript toolkit  Aims to change the way developers think  jQuery philosophy  Find some HTML  Do something to it.
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
Dynamic HTML. A combination of technologies to create dynamic web pages – xhtml – CSS – Javascript Browsers make the page that is being displayed, its.
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),
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.
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.
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.
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.
Web Programming Java Script & jQuery Web Programming.
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
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 7 JQUERY WHAT IS JQUERY? jQuery is a script. It is written in JavaScript.
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.
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.
CSCI 3100 Tutorial 5 JavaScript & Ajax Jichuan Zeng Department of Computer Science and Engineering The Chinese University of Hong.
JQuery.
JQuery Fundamentals Introduction Tutorial Videos
Tek Raj Chhetri Code for Humans not for machine.
Introduction to Web programming
JQUERY Online TRAINING AT GOLOGICA
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
Introduction to jQuery
Web Programming Language
..
E-commerce Applications Development
Document Object Model.
Web Programming Language
JavaScript and Events CS Programming Languages for Web Applications
CHAPTER 6 EVENTS. CHAPTER 6 EVENTS WHAT IS AN EVENT?
JQuery.
Presentation transcript:

JQuery March 09 th,2009 Create by

What is jQuery ? New type of JavaScript library. jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.

Why jQuery? Everything works in IE6+, firefox, safari 2+, and opera 9+ CSS 3 compliant Small size (14kb, compressed) 100s of plugins Fully documented Great community Use with other libraries.noConflict();

Other Options Script.aculo.us –provides you with easy-to-use, cross-browser user interface JavaScript libraries to make your web sites and web applications fly Prototype –Prototype is a JavaScript Framework that aims to ease development of dynamic web applications. –Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around Google Web Toolkit (GWT) –is an open source Java software development framework that makes writing AJAX applications Yahoo! User Interface Library –The Yahoo! User Interface (YUI) Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. The YUI Library also includes several core CSS resources.

Who uses jQuery? IBM BBC Google SourceForge Amazon Intuit AOL Salesforce Technorati FeedBurner Drupal WB Records Wordpress Linux.com Digg many others...

jQuery API Reference Selectors Attributes Manipulation CSS Events Effects

$(“div#contents”) Selectors Some Header....

$(“div.contents”) Selectors Some Header....

$(“div.contents > div”) Selectors Some Header....

$(“div#contents > p:first”) Selectors.....

$(“div#contents > p:last”) Selectors.....

$(“ div#contents > p:even”) Selectors.....

$(“ div#contents > p:odd”) Selectors.....

$(“ div#contents > p:eq(index)”) Selectors

API-Attributes Access a property of matched element –attr(name) Access a property on the first matched element. –attr( key, value ) Set a single property to a value, on all matched elements. –addClass( class ) Adds the specified class(es) to each of the set of matched elements. –toggleClass(class) Adds the specified class if it is not present, removes the specified class if it is present. –removeClass(class) Removes all or the specified class(es) from the set of matched elements. –hasClass(class) Returns true if the specified class is present on at least one of the set of matched elements.

Attributes Buy SKU $(document).ready(function(){ var title= $("a").attr("title"); alert( title + " No.1"); }); Expect result: get value attribute from HTML equal “Buy Now” attr(name) $("a").attr("title")

Attributes Buy SKU $(document).ready(function(){ var title= $("div#contents > a").attr("title"); alert(title); }); Expect result: get value attributes from HTML attr(name) $("div#contents > a").attr("title")

Attributes Buy SKU $(document).ready(function(){ var title= $("div#contents > a").attr("title","Add to Basket"); var after_change =$("div#contents > a").attr("title"); alert(after_change); }); Expect Result: Change title to “Add To Basket” attr( key, value) $("div#contents > a").attr("title","Add to Basket")

$(“p”).addClass(class) Attributes/addClass.selected{background:yellow;} write less, do more :1 write less, do more :2 write less, do more :3 $(document).ready(function(){ $(“p:last").addClass("selected"); }); Expect Result: p last elements added class “selected” and background yellow; Adds the specified class(es) to each of the set of matched elements.

$(“p”).toggleClass( class ) Attributes/toggleClass.highlight{background:yellow;} write less, do more :1 write less, do more :2 $(document).ready(function(){ $(“p”).click(function () { $(this).toggleClass (“highlight”); }); }); Expect Result: tag p elements toggle class “highlight” and background equal yellow; Adds the specified class if it is not present, removes the specified class if it is present. docs.jquery.com/Attributes/toggleClass#class

$(“p”).removeClass(class) Attributes/removeClass.selected{background:yellow;} write less, do more :1 write less, do more :2 write less, do more :3 $(document).ready(function(){ $("p:last").removeClass("selected"); }); Expect Result: p last elements remove class “selected” and background equal none; Remove the specified class(es) to each of the set of matched elements.

$(“p”).hasClass(class) Attributes/addClass write less, do more :1 write less, do more :2 write less, do more :3 $(document).ready(function(){ $(“p:last").hasClass("selected"); }); Expect Result: p last elements has class “selected” return true; Returns true if the specified class is present on at least one of the set of matched elements.

API-Manipulation html() Get the html contents (innerHTML) of the first matched element. This property is not available on XML documents (although it will work for XHTML documents). html(val) Set the html contents of every matched element. This property is not available on XML documents (although it will work for XHTML documents). append( content ) Append content to the inside of every matched element. after( content ) Insert content after each of the matched elements.

$(“div.contents”).html(val) Manipulation Expect Result: InnerHTML to div class=“contents” We've have got power Some Header $(document).ready(function(){ var html_code=" We've have got power "; $("div.contents").html(html_code); });

$(“div.contents”).html() Manipulation Expect Result: get InnerHTML class=“contents” Some Header $(document).ready(function(){ var html_content =$("div.contents").html(); alert(html_content); }); Get the html contents (innerHTML)

$(“ div.contents ”).append(val) Manipulation $("div.contents").append(" Venda Production "); Some Header Expect Result: append content in to inside the end elements Venda Production

$(“div.contents”).after(val) Manipulation $("div.contents").after(" Venda Production "); Some Header Expect result: insert content after div class=“content” …. ….. Venda Production

$(“div.contents”).before(val) Manipulation $("div.contents").before(" Venda Production "); Some Header Expect result: insert content before div class=“content” Venda Production …. …..

$(“div.contents”).remove(val) Manipulation Some Header $("div.contents").remove(); Expect result: remove div class=“content” Some Header

$(“div.contents”).find( expr ) Manipulation /Traversing/find $(“div.contents”). find(“span”).css(‘color’,’red’); Write less, do more 1 Jquery Traveling method find Searches for all elements that match the specified expression Expect result: Find tag span in div.contents and apply css color.

API-CSS css( name ) return a style property on the first matched element. css(properties) Set a key/value object as style properties to all matched elements. css(name,value) Set a single style property to a value on all matched elements.

$(“div.contents”).css(name) CSS div.contents { background:red; font-size:0.8em; } Some Header var color= $("div.contents").css("background-color"); Expect result: get value css “background” in div class contents var color= $("div.contents").css("background- color");

$(“div.contents”).css(name,value) CSS div.contents { background:red; font-size:0.8em; } Some Header $("div.contents").css( { 'background-color' : 'yellow'} ); Expect result: set value css “background” equal yellow in div class contents $("div.contents").css( { 'background-color' : 'yellow'} ); tip.. Can set one more properties in use once.

$(“div.contents”).css(properties) CSS div.contents { background:red; font-size:0.8em; } Some Header $("div.contents").css("background-color","green"); Expect result: set value css “background” equal green in div class contents $("div.contents").css("background- color","green");

API-Events bind( type, data, fn ) Binds a handler to one or more events (like click) for each matched element. Can also bind custom events. Possible event values: blur, focus, load, resize, scroll, unload, beforeunload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter,mouseleave,change,select,submit, keydown, keypress, keyup, error hover( over, out ) Simulates hovering (moving the mouse on, and off, an object)

$(“p”). bind( type, [data], fn ) Events/bind Some Header $(document).ready(function(){ $("p").bind("click dblclick", function(e){ $(this).toggleClass("over"); }); Expect Result: All p elements toggle class “over” and bind events “click” and dblclick. Binds a handler to one or more events (like click) for each matched element. Can also bind custom events.

Events/hover Some Header $(document).ready(function(){ $("p").hover( function(e){ $(this).toggleClass("over"); }); Expect Result: All p elements toggle class “over” when mouse on object. on mouse over apply css and on mouse off apply css $(“p”).hover ( type, [data], fn ) Simulates hovering (moving the mouse on, and off, an object). This is a custom method which provides an 'in' to a frequent task.

API-Effects show() show(speed,callback) hide() hide( speed, callback) toggle() fadeIn(speed, callback), fadeOut(speed, callback) fadeTo( speed, opacity, callback )

Effects/show.hide{display:none;} Some Header $(document).ready(function(){ $("div.contents>p:eq(0)").show(); }); Expect Result: p elements index 0 will be display. $(“p”).show() Displays each of the set of matched elements if they are hidden.

Effects/show.hide{display:none;} Some Header $(document).ready(function(){ $("div.contents>p:eq(0)").hide(); }); Expect Result: p elements index 0 will be hide. $(“p”).hide() Hides each of the set of matched elements if they are shown.

Effects/fadeIn Click $(document).ready(function(){ $("div.contents>p:eq(4)").click( function(){ $("div.contents>p:eq(0)").fadeIn("slow"); }); }); Expect Result: p elements index 0 will be fade in $(“p”).fadeIn(second) Fade in all matched elements by adjusting their opacity.

Effects/fadeOut Click $(document).ready(function(){ $("div.contents>p:eq(4)").click( function(){ $("div.contents>p:eq(0)").fadeOut("slow"); }); Expect Result: p elements index 0 will be fade out $(“p”).fadeOut(second) Fade out all matched elements by adjusting their opacity.

More info jquery.com/discuss /

Plugins Drag and Drop Sortables Tabbed Navigation Sortable Tables And hundreds more...

Javascript Venda Styles Venda.Ebiz.Productdetail.messagefadein = function(){ var message = “ Please select a Colour and Size before adding an item to bag ”; $("div#alertmessage").html(message); $("div#alertmessage").fadeIn("slow"); }

jquery.com Thank You Comments/Questions are welcome