CT-376 jQuery Most popular javascript library today Latest version: 2.1.1.

Slides:



Advertisements
Similar presentations
JavaScript – Quiz #8 Lecture Code:
Advertisements

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,
Cascading Style Sheets
Programming Club IIT Kanpur. Work environment Before you begin coding,always set up your work environment to your needs IDE Notepad++ Sublime Text 2.
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
Part 2 Introduction to CSS. CSS Syntax – class selector 1 With the class selector you can define different styles for the same type of HTML element. You.
The Document Object Model (DOM) 1 JavaScript is an object-based language—that is, it’s based on manipulating objects by changing each object’s properties.
JQuery CS 380: Web Programming. What is jQuery? jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling,
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
SE-2840 Dr. Mark L. Hornick1 jQuery. jQuery is a library of JavaScript functions Helps minimize the amount of JavaScript you have to write in order to:
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.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
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 (
JQuery CS 268. What is jQuery? From their web site:
M. Taimoor Khan Courtesy: Norman White.
PhpXperts What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.
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.
A really fairly simple guide to: mobile browser-based application development (part 4, JQuery & DOM) Chris Greenhalgh G54UBI / Chris Greenhalgh.
JQuery Adding behaviour…. Lecture Plan Review of last lesson Adding behaviour –click, mouseover Animation –fade, slideDown Navigation –parent, find, next.
Styling and theming Build campaigns in style. What we'll look at... How a web document is structured How HTML and CSS fit together Tools you will need.
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.
JQuery Write less, do more…. Lecture Plan jQuery – what and why The ready function Creating Content Changing Elements Applying CSS Applying functions.
13. jQuery See the official documentation at  See the terse API documentation at
JavaScript – The DOM JavaScript is object based The browser is object based – We can access the browser's objects in the same way we did JavaScript's Two.
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
CHAPTER 5 jQuery อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
INTRODUCTION TO CSS. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features of CSS Features of CSS  Creating Style Sheet Creating Style Sheet.
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.
Modifying HTML attributes and CSS values. Learning Objectives By the end of this lecture, you should be able to: – Select based on a class (as opposed.
JQuery Overview Unleash the Power of jQuery SoftUni Team Technical Trainers Software University
Are You Smarter Than a 5 th Grader? 1,000,000 5th Grade HTML 5th Grade Syntax 4th Grade HTML 4th Grade Syntax 3rd Grade HTML 3rd Grade Syntax 2nd Grade.
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.
JavaScript Document Object Model 1. Document Object Model (DOM) JavaScript access to the elements of an HTML document. An object hierarchy Provides access.
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.
.. 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.
CSS (Cascading Style Sheets). CSS CSS – Cascading Style Sheets – Cascade because of the way CSS rules can stack on top of each other. Allows you to add.
JQuery is a fast, small, and feature-rich javascript library. It makes things like HTML document traversal and manipulation, event handling, animation,
Tek Raj Chhetri Code for Humans not for machine.
Unleash the Power of jQuery
>> Introduction to CSS
Intro to jQuery jQuery is a popular, and extensible, JavaScript library Supports … DOM manipulation CSS manipulation HTML event methods Effects & animations.
Introduction to Web programming
JQUERY Online TRAINING AT GOLOGICA
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
JQuery with ASP.NET.
Introduction to jQuery
An introduction to jQuery
E-commerce Applications Development
Murach's JavaScript and jQuery (3rd Ed.)
Web Programming and Design
Presentation transcript:

CT-376 jQuery Most popular javascript library today Latest version: 2.1.1

jQuery ElementsElements CssCss Effects and animationsEffects and animations AjaxAjax Cross browser compatibleCross browser compatible WidgetsWidgets EventsEvents Much more,..Much more,..

jQuery Cannot look at everything within the jQuery libraryCannot look at everything within the jQuery library Retrieve elements, change element content, css, some special effects, ajax, some interactions, some widgets, in depth focus on autocompleteRetrieve elements, change element content, css, some special effects, ajax, some interactions, some widgets, in depth focus on autocomplete

jQuery - import Can automatically import the latest version of jQueryCan automatically import the latest version of jQuery

jQuery Typically:Typically: We retrieve a list of elementsWe retrieve a list of elements We perform some action on that listWe perform some action on that list

jQuery - syntax To retrieve a list of HTML elements:To retrieve a list of HTML elements: $( comma delimited list of selectors )$( comma delimited list of selectors ) Selectors can be defined by tag name, class, idSelectors can be defined by tag name, class, id

jQuery - syntax $ is another name for jQuery, a function$ is another name for jQuery, a function $( “p, h1” ) is equivalent to jQuery( “p, h1” )$( “p, h1” ) is equivalent to jQuery( “p, h1” ) Note the syntax: functionName( argumentList)Note the syntax: functionName( argumentList)

jQuery - syntax To perform some action on a list of HTML elements:To perform some action on a list of HTML elements: $( comma delimited list of selectors ).someFunction( argument list );$( comma delimited list of selectors ).someFunction( argument list );

jQuery - elements $( comma delimited list of selectors )$( comma delimited list of selectors )  returns an “array” of elements  returns an “array” of elements $( “p” ), $( “.class1” ), $(“#id44”)$( “p” ), $( “.class1” ), $(“#id44”) $( “#p2, h1,.class34, p” )$( “#p2, h1,.class34, p” )  eliminates the duplicates  eliminates the duplicates

jQuery - elements $( “p a, h2, h1.class67” )$( “p a, h2, h1.class67” ) More functionalityMore functionality $( “p:first” )  first paragraph, still returns an array$( “p:first” )  first paragraph, still returns an array $(“:contains( content)” )  elements containing content$(“:contains( content)” )  elements containing content

jQuery - elements $( “p:eq(1), p:eq(3)” )$( “p:eq(1), p:eq(3)” ) 2 nd and 4 th paragraph captured2 nd and 4 th paragraph captured Index starts at 0Index starts at 0 1  2 nd paragraph1  2 nd paragraph 3  4 th paragraph3  4 th paragraph  More details,.., on web  More details,.., on web

jQuery - html html function  equivalent to innerHTML attribute in DOMhtml function  equivalent to innerHTML attribute in DOM var elts = $( “p” );var elts = $( “p” ); elts.html( “HI” );elts.html( “HI” );  changes each paragraph’s text to HI  changes each paragraph’s text to HI

jQuery - html append function  appends to existing HTML between element tagsappend function  appends to existing HTML between element tags var elts = $( “p” );var elts = $( “p” ); elts.appends( “BYE” );elts.appends( “BYE” );  appends BYE to each paragraph  appends BYE to each paragraph

jQuery - html after function  inserts some HTML after elementsafter function  inserts some HTML after elements var elts = $( “p” );var elts = $( “p” ); elts.after( “ INSERT ” );elts.after( “ INSERT ” );  places h1 header INSERT after each paragraph  places h1 header INSERT after each paragraph

jQuery - html We can wait until the document is loaded before executing some code:We can wait until the document is loaded before executing some code: $(document).ready( function( )$(document).ready( function( ) { // some code here // some code here } );} );

jQuery - html Shorter version:Shorter version: $( function( )$( function( ) { // some code here // some code here } );} );

jQuery - html Note that the function in the previous 2 slides is anonymous.. but it does not have to beNote that the function in the previous 2 slides is anonymous.. but it does not have to be $( go ); // or $(document).ready( go );$( go ); // or $(document).ready( go ); function go( )function go( ) { // some code here // some code here }

jQuery – css class We can add or remove a css class to a list of elementsWe can add or remove a css class to a list of elements // add class blue to all paragraphs// add class blue to all paragraphs $( “p” ).addClass( “blue” );$( “p” ).addClass( “blue” ); // add classes blue and red to all paragraphs// add classes blue and red to all paragraphs $( “p” ).addClass( “blue red” );$( “p” ).addClass( “blue red” );

jQuery – css class // remove class blue for all paragraphs// remove class blue for all paragraphs $( “p” ).removeClass( “blue” );$( “p” ).removeClass( “blue” ); // toggle class blue on and off for all paragraphs// toggle class blue on and off for all paragraphs $( “p” ).toggleClass( “blue” );$( “p” ).toggleClass( “blue” );

jQuery - css css function  changing the style of elementscss function  changing the style of elements var elts = $( “p” );var elts = $( “p” ); elts.css( “background-color”, “blue” ); /* 2 parameters, attribute and value */elts.css( “background-color”, “blue” ); /* 2 parameters, attribute and value */  changes background color of each paragraph to blue  changes background color of each paragraph to blue

jQuery - css Other form of css function : 1 parameterOther form of css function : 1 parameter var elts = $( “p” );var elts = $( “p” ); elts.css( {“background-color”: “red”, “color”: “green” } ); /* 1 parameter, css style */elts.css( {“background-color”: “red”, “color”: “green” } ); /* 1 parameter, css style */  changes background color to red and foreground color to green for each paragraph  changes background color to red and foreground color to green for each paragraph

jQuery - css height and width functions  changing the size of elementsheight and width functions  changing the size of elements var elts = $( “#p2, #p3” );var elts = $( “#p2, #p3” ); elts.width( “200px”)elts.width( “200px”) elts.height( “300px” );elts.height( “300px” );  changes width and height to 200 and 300 for elements whose id is p2 or p3  changes width and height to 200 and 300 for elements whose id is p2 or p3