jquery introduction.pptx

28
Smart Business Solutions CIN# U72200TG2013PTC090172

Upload: anil-kumar-gorantala

Post on 07-Feb-2016

20 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JQuery Introduction.pptx

Smart Business Solutions

CIN# U72200TG2013PTC090172

Page 2: JQuery Introduction.pptx

Introduction What is jQuery?

jQuery is a cross-browser adds-on library for JavaScript to simplify the client-side scripting of HTML.

Its is free, open source software.

Page 3: JQuery Introduction.pptx

Benefits of jQuery The following are the benefits of jQuery.

jQuery gives Web developers and designers an easy way to create sophisticated effects with almost no coding

It is easy to implement

simplifies HTML document traversing, event handling, animating, and Ajax interactions for web development

jQuery supports CSS3 selectors and basic XPath syntax

It is used in all over the Web.

Page 4: JQuery Introduction.pptx

Software Requirements & Browser Support Software requirements

The following are the software needed for jQuery.

jQuery Library

Notepad or any HTML editor

Browser

Page 5: JQuery Introduction.pptx

Browser Support

jQuery supports the following browsers.

Internet Explorer 6+

Firefox 2.0+

Safari 3+

Opera 10.6+

Chrome 8+

Page 6: JQuery Introduction.pptx

Features in jQuery The following are the features in jQuery.

DOM element selections functions

DOM traversal and modification

Events

CSS manipulation

Effects and animations

Ajax

Extensibility

Utilities - such as browser version and the each function.

JavaScript Plug-in

Page 7: JQuery Introduction.pptx

Test Your Understanding What are the softwares required for creating jQuery?

What are the browsers that support jQuery?

Page 8: JQuery Introduction.pptx

jQuery – Overview jQuery library should be installed in your machine before it can be used. This chapter briefs you about he steps to be followed to install jQuery library.

The trainer will give you a demo to download and successfully install jQuery library.

Page 9: JQuery Introduction.pptx

jQuery- Installation Procedure Download jQuery

Download the library from www.jquery.com

Include jQuery library

Local System

<script type="text/javascript" src=“../jquery-1.6.1.min.js"></script>

Page 10: JQuery Introduction.pptx

Google CDN

http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

Microsoft CDN

http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js

http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js

http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1-vsdoc.js

Note: CDN stands for Content Delivery Network

Page 11: JQuery Introduction.pptx

jQuery Library The jQuery library is a single JavaScript file, containing all of its common DOM, event, effects, and Ajax functions.

Calling jQuery Library functions

jQuery functions will be used as soon as DOM is ready.

To perform event handling, we should call the event inside the below function

(document).ready()

Page 12: JQuery Introduction.pptx

Custom Scripts We can have our own custom code in our custom javascript file : Example – Custom.js

/* Filename: custom.js */

$(document).ready(function() {

$("div").click(function()

{

alert("Hello world!");

}); });

Page 13: JQuery Introduction.pptx

Now we can include our custom.js file in HTML file as below

<html>

<head>

<title>The jQuery Example</title>

<script type="text/javascript" src="/jquery/jquery-1.3.2.min.js">

</script>

<script type="text/javascript" src="/jquery/custom.js">

</script>

</head>

<body>

<div id="newdiv"> Click on this to see a dialogue box. </div>

</body>

</html>

Page 14: JQuery Introduction.pptx

Multiple Libraries

We can use multiple libraries all together without conflicting each others.

Example: jQuery and MooTool JavaScript libraries together.

Page 15: JQuery Introduction.pptx

jQuery- Basics jQuery allows you to interact with and manipulate elements on your Web pages.

Understanding HTML Elements

HTML elements are denoted by tags, which are letters or words in angle brackets,

< and >.

For example, <img> is an image element.

Page 16: JQuery Introduction.pptx

Overview of Elements Skeleton of HTML

<HTML>

<HEAD></HEAD>

<TITLE></TITLE>

<BODY></BODY>

</HTML>

Page 17: JQuery Introduction.pptx

jQuery- Basics (contd…)An element inside another element is the child of the outer element.

The outer element is the parent of the inner element.

An individual element can, and often is, simultaneously both a parent and a child.

Page 18: JQuery Introduction.pptx

jQuery- Basics (contd…) Common HTML Elements

•<html></html>

Tells the Web browser that everything inside the tags should be considered a

Webpage.

•<head></head>

Contains information that controls how the page is displayed. Elements

responsible for JavaScript and CSS code and calls to other files are generally

placed between these tags.

Page 19: JQuery Introduction.pptx

•<title></title>

Contains the title of the Web page, displayed on the title bar at the top of the

browser.

•<body></body>

Holds all the content of the page.

•<style></style>

Controls the appearance and behaviour of elements on your Web page.

Page 20: JQuery Introduction.pptx

•<script></script>

Makes JavaScript and other specified code available, either by calling a file or

code placed between these tags. jQuery is included on the page with this tag.

Page 21: JQuery Introduction.pptx

•<strong></strong>

Boldfaces any text within the tag.

•<h1></h1>

Creates header text.

•<div></div>

Creates a container of content.

•<p></p>

Creates a paragraph.

•<a></a>

Creates a hyperlink.

Page 22: JQuery Introduction.pptx

• <strong></strong>

Boldfaces any text within the tag.

•<h1></h1>

Creates header text.

•<div></div>

Creates a container of content.

•<p></p>

Creates a paragraph.

•<a></a>

Creates a hyperlink.

Page 23: JQuery Introduction.pptx

•<br />

Inserts a line break. No matching end tag is needed.

•<table></table>

Creates a table, along with child tags <tr></tr> and <td></td>.

•Element Attribute

An attribute is an HTML code word that controls an aspect of the element. We

can manipulate the Element Attribute using jQuery.

Page 24: JQuery Introduction.pptx

Example :

<img src= "images/home.gif" height="28" width="28" alt="Little house" />

Following are the attributes:

•src: The URL or location of the image file to display

•height: The image height in pixels

•width: The image width in pixels

•alt: The text that appears in lieu of an image or, in some browsers, when the image is moused-over for a few seconds

Page 25: JQuery Introduction.pptx

jQuery Syntax: jQuery(selector).action()

◦ jQuery keyword to get DOM elements ◦ A (selector) to "query (or find)" HTML elements ◦ A jQuery action() to be performed on the element(s)

Page 26: JQuery Introduction.pptx

The $() factory function $(selector).action()

A dollar sign to define jQuery. The factory function $() is a synonym of jQuery() function

A (selector) to "query (or find)" HTML elements

A jQuery action() to be performed on the element(s)

Page 27: JQuery Introduction.pptx
Page 28: JQuery Introduction.pptx

Thank You…