Intro to jquery. Web Systems 02/17/2012

Similar documents
The purpose of jquery is to make it much easier to use JavaScript on your website.

jquery Tutorial for Beginners: Nothing But the Goods

Facebook Twitter YouTube Google Plus Website . o Zooming and Panning. Panel. 3D commands. o Working with Canvas

This matches a date in the MM/DD/YYYY format in the years The date must include leading zeros.

Advantage of Jquery: T his file is downloaded from

WEB DEVELOPMENT COURSE (PHP/ MYSQL)

Tutorial JavaScript: Switching panels using a radio button

Example. Represent this as XML

CMSC434 TUTORIAL #3 HTML CSS JavaScript Jquery Ajax + Google AppEngine Mobile WebApp HTML5

MASTERTAG DEVELOPER GUIDE

WP Popup Magic User Guide

Responsive Web Design Creative License

Skills for Employment Investment Project (SEIP)

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

Making Web Application using Tizen Web UI Framework. Koeun Choi

JQUERY - EFFECTS. Showing and Hiding elements. Syntax. Example

^/ CS> KRIS. JAMSA, PhD, MBA. y» A- JONES & BARTLETT LEARNING

Overview. In the beginning. Issues with Client Side Scripting What is JavaScript? Syntax and the Document Object Model Moving forward with JavaScript

Citrix StoreFront. Customizing the Receiver for Web User Interface Citrix. All rights reserved.

Lecture 9 Chrome Extensions

AUDIT REPORT EXAMPLE

( François Agneray. Octobre 2012

Subject Tool Remarks What is JQuery. Slide Javascript Library

JTouch Mobile Extension for Joomla! User Guide

Web Development 1 A4 Project Description Web Architecture

A set-up guide and general information to help you get the most out of your new theme.

Debugging JavaScript and CSS Using Firebug. Harman Goei CSCI 571 1/27/13

Performance Testing for Ajax Applications

Study on Parallax Scrolling Web Page Conversion Module

Web Programming Step by Step

How To Change Your Site On Drupal Cloud On A Pcode On A Microsoft Powerstone On A Macbook Or Ipad (For Free) On A Freebie (For A Free Download) On An Ipad Or Ipa (For

Dashboard Skin Tutorial. For ETS2 HTML5 Mobile Dashboard v3.0.2

Installing and Sending with DocuSign for NetSuite v2.2

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

CLASSROOM WEB DESIGNING COURSE

Selenium Automation set up with TestNG and Eclipse- A Beginners Guide

Web Components What s the Catch? TJ

BT CONTENT SHOWCASE. JOOMLA EXTENSION User guide Version 2.1. Copyright 2013 Bowthemes Inc.

How to Customize the Default Search Form in WordPress

Mobile App Design and Development

Interactive Data Visualization for the Web Scott Murray

Interactive Web Development ITP 301 (4 Units)

JW Player for Flash and HTML5

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

Using jquery and CSS to Gain Easy Wins in CiviCRM

CoffeeScript and Drupal. Mark Horgan

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Fast track to HTML & CSS 101 (Web Design)

HP LoadRunner. Software Version: Ajax TruClient Tips & Tricks

Learning Web App Development

Team Members: Christopher Copper Philip Eittreim Jeremiah Jekich Andrew Reisdorph. Client: Brian Krzys

Progressive Enhancement With GQuery and GWT. Ray Cromwell

Maximizing the Use of Slide Masters to Make Global Changes in PowerPoint

JavaScript Testing. Beginner's Guide. Liang Yuxian Eugene. Test and debug JavaScript the easy way PUBLISHING MUMBAI BIRMINGHAM. k I I.

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Using Spry Widgets. In This Chapter

Front-End Performance Testing and Optimization

ICE: HTML, CSS, and Validation

ITCS QUICK REFERENCE GUIDE: EXPRESSION WEB SITE

Web Development I & II*

Microsoft PowerPoint 2010

Dreamweaver Tutorial - Dreamweaver Interface

Web Development Recipes

This tutorial provides detailed instructions to help you download and configure Internet Explorer 6.0 for use with Web Commerce application.

Using an external style sheet with Dreamweaver (CS6)

Client-side Web Engineering From HTML to AJAX

PLAYER DEVELOPER GUIDE

NetFlow for SouthWare NetLink

Intro to Web Programming. using PHP, HTTP, CSS, and Javascript Layton Smith CSE 4000

WP Popup Magic User Guide

Programming in HTML5 with JavaScript and CSS3

jquery Sliding Image Gallery

Mistral Joomla Template

WebIOPi. Installation Walk-through Macros

QML and JavaScript for Native App Development

Microsoft PowerPoint Tutorial

OPENTABLE GROUP SEARCH MODULE GETTING STARTED ADD RESERVATIONS TO YOUR WEBSITE

Sitecore Dashboard User Guide

Agile Web Application Testing

HTML5. Turn this page to see Quick Guide of CTTC

Dashcode User Guide. (Retired Document)

Pay with Amazon Integration Guide

ACE: Dreamweaver CC Exam Guide

The Smart Forms Web Part allows you to quickly add new forms to SharePoint pages, here s how:

Website Planning Checklist

Microsoft PowerPoint 2011

Transcription:

Intro to jquery Web Systems 02/17/2012

What is jquery? A JavaScript library Lightweight (about 31KB for the minified version) Simplifies HTML document traversing (DOM), event handling, animations, and more o "write less, do more"

<aside>minification Removal of all unnecessary characters in code o e.g. whitespace new line chars, and comments Reduces amount of data needed to be transfered o Smaller file size = quicker page loads, but less readability A lot of tools that compress the source code for you o jscompress.com is just one

How To Add jquery Lastest stable version is 1.7.1 Download it and store locally o <script type="text/javascript" src="jquery.js"></script> Use the hosted jquery library o <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jque ry.min.js"></script> o <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery- 1.7.1.min.js"></script>

jquery Syntax $(selector).action(); o $ (typically) used to define jquery o Selector - HTML element to "query" or find o Action - What to do jquery action to perform

<aside> Defining jquery $ is shorthand for the standard function (full name is jquery) o $(document).ready = jquery(document).ready o Syntactically the same Problem: '$' is used as shorthand for other JavaScript library objects There's a way to get around this: o jquery noconflict() method o Ex. var jq = jquery().noconflict(); jq(document).ready( function () { jq("p").hide(); });

Event Handlers jquery methods called when an event is "triggered" or "fired" It's common to put most jquery functions within $ (document).ready(function) o This waits until the entire page is loaded $(document).ready(function() { $("p.change").click(function() { //do something here }); });

jquery Selectors Allow you to manipulate/traverse HTML DOM element There are 3 types of jquery Selectors o (Think of the CSS lectures!)

Element Selectors jquery uses CSS to select HTML elements $("h1") - selects all <h1> elements $("p.fname") - selects all <p> with the class = "fname" $("h2#lname") - selects the <td> with the id = "lname" $("#contact") - selects all elements with id = "contact" o (There should only be one!) http://droto.net/websys/jquery/element-selectors.html

Attribute Selectors jquery uses XPath to select elements with the given attributes $("[href]") - selects all elements with the href attribute $("[name = 'fname']") - selects all elements where the name attribute is equal to "fname" $("[href!='#']") - selects all elements with href attribute does NOT equal "#" http://droto.net/websys/jquery/attribute-selectors.html

CSS Selectors Changes the CSS properties of the HTML elements $(selector).css("css-property", "value"); o Can pass just the property to get the current value (the first matched element is returned) o Can pass multiple properties $("h1").css("color", "green") - changes the color of all h1 elements to green $("h1").css({"background-color":"yellow","fontsize":"200%"}) - changes all h1 elements to have a background color yellow and font size to 200% http://droto.net/websys/jquery/css-selectors.html

jquery HTML Manipulation jquery gives you some methods to manipulate the DOM.addClass() - lets you add one or more classes to the element.html() - sets or returns the content (innerhtml) of a element.before() - adds content before the given element.val() - sets or gets the value of a (form) element http://droto.net/websys/jquery/html-manipulation.html

jquery HTML Manipulation Cont. Ok cool, but what about this: You dynamically add a new element (via jquery or some other method) and want to bind an event to it. You can use the.on() method o $(parent-element-to-monitor).on("event(s)", "elementto-attach-event", eventhandler()); o Ex. $(document).on( "click", "p", function(event) { alert("cool text here!"); }); http://droto.net/websys/jquery/jq-on.html

jquery Effects The "old" way to do hide, show, slide, toggle, fade, and animate. (A lot of this can be done with CSS3 now). $("p#hideme").hide() - hides the p element with the id $("h1").fadein() - does a fade in animation to all h1 elements

jquery Effects (Callbacks) Cont. The callback parameter Waits to execute a function until after the parent function is executed Useful since JavaScript is a interpreted language o Since JS executes line by line

jquery Effects (Callbacks) Cont. What's the difference between these two functions? $("p").hide(1000); alert("the paragraph is now hidden"); $("p").hide(1000,function(){ alert("the paragraph is now hidden"); }); http://droto.net/websys/jquery/callback.html

jquery UI Official jquery user interface library o Basically a set of useful/"official" jquery plugins Convient UI interactions Useful widgets Cool effects Easy to use theme framework

Using jquery UI Lastest stable version is 1.8.17 o http://jqueryui.com/download o Lets you download only things you want Just have to include the.js and.css files on your pages

Some Basic UI Interactions Draggable - lets you make any DOM elements draggable Resizable - lets you resize any DOM element Selectable - makes a DOM element, or group of elements, selectable http://droto.net/websys/jquery/jqui-interactions.html

Useful Widgets Datepicker - A highly configurable UI datepicker Autocomplete - Allows a Google Search like autocomplete function Button - Makes making things that aren't typically buttons be buttons Tabs - Used to break content into different sections Dialog - Similar to JS alert, but more configureable http://droto.net/websys/jquery/jqui-widgets.html

jquery UI Effects Basically some convenience methods that extend the functionality of jquery Animate - extends the core jquery animate function to animate by color Hide/Show - enables animation for the effects switchclass - lets you switch from one class to another

jquery UI Themes jquery UI plugins are all styled by CSS (both the core jquery UI style and plugin specific style) Makes it easy to keep the look and feel consistent Given the ability to create your own customized theme http://jqueryui.com/themeroller/

<footer> http://droto.net/websys/jquery/examples.html for all the examples and more resources. Have a great weekend!