Jquery
JQuery
• jQuery is a JavaScript Library.
• jQuery greatly simplifies JavaScript programming.
• jQuery is easy to learn.
Adding jQuery to Your Web Pages
• Download the jQuery library from jQuery.com or
• Include jQuery from a CDN, like Google
• There are two versions of jQuery available for downloading:
– Production version - this is for your live website because it has been
minified and compressed
– Development version - this is for testing and development
(uncompressed and readable code)
jQuery Syntax
$(selector).action()
Selectors are used in
jQuery to find out DOM
elements
A jQuery action() to be performed
on the element(s)
using $("#id") or jQuery("#id") is the same
example
• $(this).hide() - hides the current element.
• $("p").hide() - hides all <p> elements.
• $(".test").hide() - hides all elements with class="test".
• $("#test").hide() - hides the element with id="test".
Different type of selectors
• The element Selector
– $("p")
• The #id Selector
– $("#test")
• The .class Selector
– $(".test")
Different actions
• hide() :hides the selector
• click(function (){}) : executest the function when click on
the selector
• parent() :returns the parent of the selector
• Parents() : return all the parent of the selector
up to HTML
jQuery noConflict()
• What if other JavaScript frameworks also use the $ sign as a shortcut?
• The noConflict() method releases the hold on the $ shortcut identifier, so
that other scripts can use it.
• You can of course still use jQuery, simply by writing the full name instead
of the shortcut:
$.noConflict();
jQuery(document).ready(function(){
jQuery("button").click(function(){
jQuery("p").text("jQuery is still working!");
});
});
$.each in jquery
<script>
var arr = [ "one", "two", "three", "four", "five" ];
var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 };
$.each( arr, function( i, val ) {
$( "#" + val ).text( "Mine is " + val + "." );
return ( val !== "three" );
});
jQuery.each( obj, function( i, val ) {
$( "#" + i ).append( document.createTextNode( " - " + val ) );
});
</script>
JQuery Traversing
• Parent()
• Parents()
• Children()
• Find()
• siblings()
• First()
• Next()
• Prev()
Example
<html><head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
alert($("#sub1").parent().attr('id'));
alert($("#sub1").next().attr('id'));
alert($("#sub2").parents().find('div').attr('id'));
alert($("#sub1").siblings().text());
});
</script></head>
<body>
<div id="main"><p id="sub1">first text</p><p id="sub2">last text</p></div>
</body></html>
Binding handler
• Click
• Live
• Delegate
• On
Use .click(function) when binding a
handler directly to an element, like this:
$(document).click(function() {
alert("You clicked somewhere in the
page, it bubbled to document"); });
elements that weren't there when this
code was run to attach the handler (e.g.
the selector found it then) won't get the
handler.
Binding handler
• Click
• Live
• Delegate
• On
These three can be used for
dynamically generated elements.
Binding handler
• Click
• Live
• Delegate
• On
You use this when your elements may
change, e.g. adding new rows, list items,
etc.
$(".clickAlert").live('click', function() {
alert("A click happened"); });
Binding handler
• Click
• Live
• Delegate
• On
If however you do have a parent element
somewhere that isn't getting replaced.
you should handle it with .delegate(), like
this:
$("#commonParent").delegate('.clickAlert
', 'click', function() { alert("A click
happened, it was captured at
#commonParent and this alert ran"); });
Binding handler
• Click
• Live
• Delegate
• On
Functions are same as delegate(). Attach
an event handler function for one or
more events to the selected elements.
$( "#dataTable tbody" ).on( "click", "tr",
function() {
alert( $( this ).text() );
});
Questions?
“A good question deserve a good grade…”
End of day
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

More Related Content

PPTX
jQuery Fundamentals
PPTX
jQuery
PPTX
Basics of j query
PPTX
PDF
Prototype & jQuery
PPTX
Jquery
PPTX
JQuery
jQuery Fundamentals
jQuery
Basics of j query
Prototype & jQuery
Jquery
JQuery

What's hot (20)

PDF
Javascript session june 2013 (iii) jquery json
PDF
jQuery for beginners
PPTX
PPTX
PPTX
How to increase Performance of Web Application using JQuery
PPTX
Jquery-overview
PPT
Kick start with j query
ODP
Introduction to jQuery
PPT
JQuery introduction
PDF
Write Less Do More
PDF
J querypractice
PPTX
jQuery Presentasion
PPTX
jQuery
PDF
jQuery Essentials
PDF
Introduction to jQuery
PDF
D3.js and SVG
PPTX
JQuery
PDF
Learning jQuery in 30 minutes
PPT
J query b_dotnet_ug_meet_12_may_2012
PDF
jQuery Loves Developers - Oredev 2009
Javascript session june 2013 (iii) jquery json
jQuery for beginners
How to increase Performance of Web Application using JQuery
Jquery-overview
Kick start with j query
Introduction to jQuery
JQuery introduction
Write Less Do More
J querypractice
jQuery Presentasion
jQuery
jQuery Essentials
Introduction to jQuery
D3.js and SVG
JQuery
Learning jQuery in 30 minutes
J query b_dotnet_ug_meet_12_may_2012
jQuery Loves Developers - Oredev 2009
Ad

Viewers also liked (12)

Ad

Similar to Jquery (20)

PPTX
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
PDF
Learning jquery-in-30-minutes-1195942580702664-3
PDF
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
PPT
J query
PPTX
Jquery Complete Presentation along with Javascript Basics
PPT
J query module1
PDF
22 j query1
PDF
bcgr3-jquery
PDF
bcgr3-jquery
PPTX
JavaScript!
PPTX
J query1
PDF
KEY
Bcblackpool jquery tips
PPTX
Jquery fundamentals
PPTX
Jquery introduction
PDF
Advanced JQuery Mobile tutorial with Phonegap
PDF
Understanding backbonejs
PDF
jQuery Rescue Adventure
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
Learning jquery-in-30-minutes-1195942580702664-3
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
J query
Jquery Complete Presentation along with Javascript Basics
J query module1
22 j query1
bcgr3-jquery
bcgr3-jquery
JavaScript!
J query1
Bcblackpool jquery tips
Jquery fundamentals
Jquery introduction
Advanced JQuery Mobile tutorial with Phonegap
Understanding backbonejs
jQuery Rescue Adventure

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
PDF
Acquiring new skills what you should know
PDF
Baabtra.com programming at school
PDF
99LMS for Enterprises - LMS that you will love
PPTX
Chapter 6 database normalisation
PPTX
Chapter 5 transactions and dcl statements
PPTX
Chapter 4 functions, views, indexing
PPTX
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
Chapter 1 introduction to sql server
PPTX
Chapter 1 introduction to sql server
Agile methodology and scrum development
Acquiring new skills what you should know
Baabtra.com programming at school
99LMS for Enterprises - LMS that you will love
Chapter 6 database normalisation
Chapter 5 transactions and dcl statements
Chapter 4 functions, views, indexing
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server

Recently uploaded (20)

PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PPTX
Module 1 Introduction to Web Programming .pptx
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
MuleSoft-Compete-Deck for midddleware integrations
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
Auditboard EB SOX Playbook 2023 edition.
DOCX
search engine optimization ppt fir known well about this
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Module 1 Introduction to Web Programming .pptx
Data Virtualization in Action: Scaling APIs and Apps with FME
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Basics of Cloud Computing - Cloud Ecosystem
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
sbt 2.0: go big (Scala Days 2025 edition)
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
The influence of sentiment analysis in enhancing early warning system model f...
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
Enhancing plagiarism detection using data pre-processing and machine learning...
MuleSoft-Compete-Deck for midddleware integrations
Convolutional neural network based encoder-decoder for efficient real-time ob...
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Auditboard EB SOX Playbook 2023 edition.
search engine optimization ppt fir known well about this

Jquery