SlideShare a Scribd company logo
JQUERY
MUHAMMAD EHTISHAM SIDDIQUI
APTECH COMPUTER EDUCATION
TOPICS TO BE COVERED
Introduction to JQuery.
Purpose of JQuery.
How to use Jquery.
Syntax of using JQuery.
Functions and Events of JQuery.
Selectors and functions of JQuery.
Example of JQuery.
WHAT IS JQUERY?
jQuery is a lightweight, "write less, do more", JavaScript library.
The purpose of jQuery is to make it much easier to use JavaScript on
your website.
jQuery takes a lot of common tasks that require many lines of
JavaScript code to accomplish, and wraps them into methods that you
can call with a single line of code.
• Many of the biggest companies on the Web use jQuery, such as:
• Google
• Microsoft
• IBM
• Netflix
WHAT IS JQUERY?
PURPOSE OF JQUERY
The purpose of jQuery is to make it much easier to use JavaScript
on your website.
We can take advantages of JavaScript for:-
• It helps to improve the performance of the application
• It helps to develop most browser compatible web page
• It helps to implement UI related critical functionality without writing
hundreds of lines of codes
• It is fast
• It is extensible – jQuery can be extended to implement customized
behavior
HOW TO USE JQUERY?
There are two ways to use JQuery.
Download JQuery file from http://jquery.com/download/
And link JQuery file in your HTML page.
<head>
<script src="jquery-3.3.1.min.js"></script>
</head>
Use online JQuery file CDN(Content Delivery Network)
<script type="text/javascript" language="Javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js">
</script>
HOW TO USE JQUERY?
IF CDN Doesn’t support you can use your local file.
<script type="text/javascript" language="Javascript"
src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.1.min.js"></script>
<script type='text/javascript'>//<![CDATA[
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript
src='/Script/jquery-1.4.1.min.js' type='text/javascript' %3E%3C/script%3E"));
}//]]>
</script>
SYNTAX OF JQUERY
The jQuery syntax is tailor-made for selecting HTML elements and performing
some action on the element(s).
Basic syntax is: $(selector).action()
 A $ sign to define/access jQuery
 A (selector) to "query (or find)" HTML elements
 A jQuery action() to be performed on the element(s)
Syntax:-
$(document).action(function(){
// jQuery methods go here...
});
SELECTING ELEMENTS IN JQUERY
SELECTING ELEMENTS IN JQUERY(CSS SELECTORS)
SELECTING ELEMENTS IN JQUERY(CUSTOM SELECTORS)
EXAMPLE OF SELECTORS
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
}); });
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me to hide paragraphs</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#test").hide();
}); });
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p id="test">This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
EXAMPLE OF SELECTORS(CSS SELECTORS)
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>animated demo</title> <style>
div {
background: yellow;
border: 1px solid #AAA;
width: 80px;
height: 80px;margin: 0 5px;float: left;}
div.colored {background: green;}</style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script></head><body>
<button id="run">Run</button>
<div></div>
<div id="mover"></div><div></div><script> $( "#run" ).click(function() { $( "div:animated" ).toggleClass( "colored" );});function animateIt() {
$( "#mover" ).slideToggle( "slow", animateIt );}
animateIt();
</script>
</body>
</html>
CSS CLASS NAME
CSS STYLES
EXAMPLE OF CSS STYLES USING JQUERY
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input").focus(function(){
$(this).css("background-color", "#cccccc");
});
$("input").blur(function(){
$(this).css("background-color", "#ffffff");
});
});
</script>
</head>
<body>
Name: <input type="text" name="fullname"><br>
Email: <input type="text" name="email">
</body>
</html>
EXAMPLE OF CSS STYLES USING JQUERY
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").on({
mouseenter: function(){
$(this).css("background-color", "lightgray");
},
mouseleave: function(){
$(this).css("background-color", "lightblue"); },
click: function(){
$(this).css("background-color", "yellow");
} });});
</script>
</head>
<body>
<p>Click or move the mouse pointer over this paragraph.</p>
</body>
</html>
EXAMPLE OF CSS STYLES USING JQUERY
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").on({
mouseenter: function(){
$(this).css("background-color", "lightgray");
},
mouseleave: function(){
$(this).css("background-color", "lightblue"); },
click: function(){
$(this).css("background-color", "yellow");
} });});
</script>
</head>
<body>
<p>Click or move the mouse pointer over this paragraph.</p>
</body>
</html>
JQUERY EVENTS
All the different visitor's actions that a web page can respond to are called
events.
An event represents the precise moment when something happens.
Examples:
 moving a mouse over an element
 selecting a radio button
 clicking on an element
JQUERY EVENTS
Mouse Events Keyboard Events Form Events Document/Window
Events
click keypress submit load
dblclick keydown change resize
mouseenter keyup focus scroll
mouseleave blur unload
JQUERY EVENTS
Mouse Events Keyboard Events Form Events Document/Window
Events
click keypress submit load
dblclick keydown change resize
mouseenter keyup focus scroll
mouseleave blur unload
JQUERY EVENTS(MOUSE) -> CLICK
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
</body>
JQUERY EVENTS(MOUSE) -> DBL CLICK
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").dblclick(function(){
$(this).hide();
});
});
</script>
</head>
<body>
<p>If you double-click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
</body>
</html>
JQUERY EVENTS(MOUSE) -> MOUSE ENTER
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#p1").mouseenter(function(){
alert("You entered p1!");
});
});
</script>
</head>
<body>
<p id="p1">Enter this paragraph.</p>
</body>
</html>
JQUERY EVENTS(MOUSE) -> HOVER
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#p1").hover(function(){
alert("You entered p1!");
}, function(){
alert("Bye! You now leave p1!");
});
});
</script>
</head>
<body>
<p id="p1">This is a paragraph.</p>
</body>
</html>
JQUERY EVENTS(MOUSE) -> BLUR
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#p1").hover(function(){
alert("You entered p1!");
},
function(){
alert("Bye! You now leave p1!");
});
});
</script>
</head>
<body>
<p id="p1">This is a paragraph.</p>
</body>
</html>
HIDE/SHOW
<!DOCTYPE html>
<html><head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><script>
$(document).ready(function(){
$("#hide").click(function(){
$("p").hide();
});
$("#show").click(function(){
$("p").show();
});
});
</script>
</head>
<body>
<p>If you click on the "Hide" button, I will disappear.</p>
<button id="hide">Hide</button>
<button id="show">Show</button>
</body>
</html>
HIDE WITH SPEED
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide(1000);
});
});
</script>
</head>
<body>
<button>Hide</button>
<p>This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>
</body>
</html>
TOGGLE
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").hover(function(){
$("p").toggle(1000);
});
});
</script>
</head>
<body>
<button>Toggle between hiding and showing the paragraphs</button>
<p>This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>
</body>
</html>
TOGGLE
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").hover(function(){
$("p").toggle(1000);
});
});
</script>
</head>
<body>
<button>Toggle between hiding and showing the paragraphs</button>
<p>This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>
</body>
</html>
FADEIN()
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").fadeIn();
$("#div2").fadeIn("slow");
$("#div3").fadeIn(3000) ; }); });
</script>
</head>
<body>
<p>Demonstrate fadeIn() with different parameters.</p>
<button>Click to fade in boxes</button><br><br>
<div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div><br>
<div id="div2" style="width:80px;height:80px;display:none;background-color:green;"></div><br>
<div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div>
</body></html>
FADEOUT()
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").fadeOut();
$("#div2").fadeOut("slow");
$("#div3").fadeOut(3000);
}); });
</script></head>
<body>
<p>Demonstrate fadeOut() with different parameters.</p>
<button>Click to fade out boxes</button><br><br>
<div id="div1" style="width:80px;height:80px;background-color:red;"></div><br>
<div id="div2" style="width:80px;height:80px;background-color:green;"></div><br>
<div id="div3" style="width:80px;height:80px;background-color:blue;"></div></body></html>
FADEIN() & FADEOUT()
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").fadeToggle();
$("#div2").fadeToggle("slow");
$("#div3").fadeToggle(3000);
}); });
</script>
</head><body>
<p>Demonstrate fadeToggle() with different speed parameters.</p>
<button>Click to fade in/out boxes</button><br><br>
<div id="div1" style="width:80px;height:80px;background-color:red;"></div><br>
<div id="div2" style="width:80px;height:80px;background-color:green;"></div><br>
<div id="div3" style="width:80px;height:80px;background-color:blue;"></div></body></html>
SLIDE
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("slow"); }); }); </script> <style>
#panel, #flip {
padding: 5px;
text-align: center;
background-color: #e5eecc;
border: solid 1px #c3c3c3; }#panel {
padding: 50px;
display: none;}</style></head><body>
<div id="flip">Click to slide the panel down or up</div>
<div id="panel">Hello world!</div>
</body>
</html>
ANIMATION
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("div").animate({
left: '250px',
height: '+=150px',
width: '+=150px'
}); }); });</script> </head><body>
<button>Start Animation</button>
<p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of
the element to relative, fixed, or absolute!</p>
<div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div>
</body>
</html>
ANIMATION
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("div").animate({
height: 'toggle' }); }); });
</script>
</head>
<body>
<p>Click the button multiple times to toggle the animation.</p>
<button>Start Animation</button>
<p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of
the element to relative, fixed, or absolute!</p>
<div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div>
</body>
</html>
J Query (Complete Course) by Muhammad Ehtisham Siddiqui

More Related Content

What's hot

SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
Mark Rackley
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobile
ejlp12
 
jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )
EZoApp
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');
mikehostetler
 
jQuery besic
jQuery besicjQuery besic
jQuery besic
Syeful Islam
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
Remy Sharp
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
Dave Artz
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQueryAngel Ruiz
 
Client Web
Client WebClient Web
Client Web
Markiyan Matsekh
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
Bedis ElAchèche
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
Rod Johnson
 
Migration to jQuery 3.5.x
Migration to jQuery 3.5.xMigration to jQuery 3.5.x
Migration to jQuery 3.5.x
StanislavIdolov
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
velveeta_512
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
dmethvin
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
Matt Raible
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
Zeeshan Khan
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersJonathan Sharp
 
Overview on jQuery mobile
Overview on jQuery mobileOverview on jQuery mobile
Overview on jQuery mobile
Md. Ziaul Haq
 
jQuery
jQueryjQuery

What's hot (20)

SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobile
 
jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )jQuery Mobile Introduction ( demo on EZoapp )
jQuery Mobile Introduction ( demo on EZoapp )
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');
 
jQuery besic
jQuery besicjQuery besic
jQuery besic
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
Client Web
Client WebClient Web
Client Web
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
Migration to jQuery 3.5.x
Migration to jQuery 3.5.xMigration to jQuery 3.5.x
Migration to jQuery 3.5.x
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for Developers
 
Overview on jQuery mobile
Overview on jQuery mobileOverview on jQuery mobile
Overview on jQuery mobile
 
jQuery
jQueryjQuery
jQuery
 

Similar to J Query (Complete Course) by Muhammad Ehtisham Siddiqui

Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
Collaboration Technologies
 
jQuery
jQueryjQuery
Short intro to JQuery and Modernizr
Short intro to JQuery and ModernizrShort intro to JQuery and Modernizr
Short intro to JQuery and ModernizrJussi Pohjolainen
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
AnamikaRai59
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
Rakesh Jha
 
J query
J queryJ query
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
iFour Institute - Sustainable Learning
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptx
AditiPawale1
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery Basics
Kaloyan Kosev
 
JQuery Comprehensive Overview
JQuery Comprehensive OverviewJQuery Comprehensive Overview
JQuery Comprehensive Overview
Mohamed Loey
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
Umeshwaran V
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NET
James Johnson
 
Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with PhonegapIntroduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
Rakesh Jha
 
J query presentation
J query presentationJ query presentation
J query presentationakanksha17
 

Similar to J Query (Complete Course) by Muhammad Ehtisham Siddiqui (20)

Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery
jQueryjQuery
jQuery
 
Short intro to JQuery and Modernizr
Short intro to JQuery and ModernizrShort intro to JQuery and Modernizr
Short intro to JQuery and Modernizr
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
 
JQuery
JQueryJQuery
JQuery
 
J query
J queryJ query
J query
 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptx
 
JQuery
JQueryJQuery
JQuery
 
JQuery
JQueryJQuery
JQuery
 
J query training
J query trainingJ query training
J query training
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery Basics
 
Jquery library
Jquery libraryJquery library
Jquery library
 
JQuery Comprehensive Overview
JQuery Comprehensive OverviewJQuery Comprehensive Overview
JQuery Comprehensive Overview
 
Jquery
JqueryJquery
Jquery
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NET
 
Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with PhonegapIntroduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
 
J query presentation
J query presentationJ query presentation
J query presentation
 

More from Muhammad Ehtisham Siddiqui

C programming Tutorial Session 4
C programming Tutorial Session 4C programming Tutorial Session 4
C programming Tutorial Session 4
Muhammad Ehtisham Siddiqui
 
C programming Tutorial Session 4
C programming Tutorial Session 4C programming Tutorial Session 4
C programming Tutorial Session 4
Muhammad Ehtisham Siddiqui
 
C programming Tutorial Session 3
C programming Tutorial Session 3C programming Tutorial Session 3
C programming Tutorial Session 3
Muhammad Ehtisham Siddiqui
 
C programming Tutorial Session 2
C programming Tutorial Session 2C programming Tutorial Session 2
C programming Tutorial Session 2
Muhammad Ehtisham Siddiqui
 
C programming Tutorial Session 1
C programming Tutorial Session 1C programming Tutorial Session 1
C programming Tutorial Session 1
Muhammad Ehtisham Siddiqui
 
HTML5 Web storage
HTML5 Web storageHTML5 Web storage
HTML5 Web storage
Muhammad Ehtisham Siddiqui
 
JavaScript Session 2
JavaScript Session 2JavaScript Session 2
JavaScript Session 2
Muhammad Ehtisham Siddiqui
 
JavaScript Session 3
JavaScript Session 3JavaScript Session 3
JavaScript Session 3
Muhammad Ehtisham Siddiqui
 
Javascript session 1
Javascript session 1Javascript session 1
Javascript session 1
Muhammad Ehtisham Siddiqui
 
Html audio video
Html audio videoHtml audio video
Html audio video
Muhammad Ehtisham Siddiqui
 
Html 5 geolocation api
Html 5 geolocation api Html 5 geolocation api
Html 5 geolocation api
Muhammad Ehtisham Siddiqui
 
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham SiddiquiBuiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation  Websites Session 7 by Muhammad Ehtisham SiddiquiBuilding Next Generation  Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session6
Building Next Generation Websites Session6Building Next Generation Websites Session6
Building Next Generation Websites Session6
Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session5
Building Next Generation Websites Session5Building Next Generation Websites Session5
Building Next Generation Websites Session5
Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session4
Building Next Generation Websites Session4Building Next Generation Websites Session4
Building Next Generation Websites Session4
Muhammad Ehtisham Siddiqui
 
Session4
Session4Session4
Office session14
Office session14Office session14
Office session14
Muhammad Ehtisham Siddiqui
 

More from Muhammad Ehtisham Siddiqui (20)

C programming Tutorial Session 4
C programming Tutorial Session 4C programming Tutorial Session 4
C programming Tutorial Session 4
 
C programming Tutorial Session 4
C programming Tutorial Session 4C programming Tutorial Session 4
C programming Tutorial Session 4
 
C programming Tutorial Session 3
C programming Tutorial Session 3C programming Tutorial Session 3
C programming Tutorial Session 3
 
C programming Tutorial Session 2
C programming Tutorial Session 2C programming Tutorial Session 2
C programming Tutorial Session 2
 
C programming Tutorial Session 1
C programming Tutorial Session 1C programming Tutorial Session 1
C programming Tutorial Session 1
 
HTML5 Web storage
HTML5 Web storageHTML5 Web storage
HTML5 Web storage
 
JavaScript Session 2
JavaScript Session 2JavaScript Session 2
JavaScript Session 2
 
JavaScript Session 3
JavaScript Session 3JavaScript Session 3
JavaScript Session 3
 
Javascript session 1
Javascript session 1Javascript session 1
Javascript session 1
 
Html audio video
Html audio videoHtml audio video
Html audio video
 
Html 5 geolocation api
Html 5 geolocation api Html 5 geolocation api
Html 5 geolocation api
 
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham SiddiquiBuiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation  Websites Session 7 by Muhammad Ehtisham SiddiquiBuilding Next Generation  Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session6
Building Next Generation Websites Session6Building Next Generation Websites Session6
Building Next Generation Websites Session6
 
Building Next Generation Websites Session5
Building Next Generation Websites Session5Building Next Generation Websites Session5
Building Next Generation Websites Session5
 
Building Next Generation Websites Session4
Building Next Generation Websites Session4Building Next Generation Websites Session4
Building Next Generation Websites Session4
 
Session4
Session4Session4
Session4
 
Office session14
Office session14Office session14
Office session14
 

Recently uploaded

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

J Query (Complete Course) by Muhammad Ehtisham Siddiqui

  • 2. TOPICS TO BE COVERED Introduction to JQuery. Purpose of JQuery. How to use Jquery. Syntax of using JQuery. Functions and Events of JQuery. Selectors and functions of JQuery. Example of JQuery.
  • 3. WHAT IS JQUERY? jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. • Many of the biggest companies on the Web use jQuery, such as: • Google • Microsoft • IBM • Netflix
  • 5. PURPOSE OF JQUERY The purpose of jQuery is to make it much easier to use JavaScript on your website. We can take advantages of JavaScript for:- • It helps to improve the performance of the application • It helps to develop most browser compatible web page • It helps to implement UI related critical functionality without writing hundreds of lines of codes • It is fast • It is extensible – jQuery can be extended to implement customized behavior
  • 6. HOW TO USE JQUERY? There are two ways to use JQuery. Download JQuery file from http://jquery.com/download/ And link JQuery file in your HTML page. <head> <script src="jquery-3.3.1.min.js"></script> </head> Use online JQuery file CDN(Content Delivery Network) <script type="text/javascript" language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"> </script>
  • 7. HOW TO USE JQUERY? IF CDN Doesn’t support you can use your local file. <script type="text/javascript" language="Javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.1.min.js"></script> <script type='text/javascript'>//<![CDATA[ if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/Script/jquery-1.4.1.min.js' type='text/javascript' %3E%3C/script%3E")); }//]]> </script>
  • 8. SYNTAX OF JQUERY The jQuery syntax is tailor-made for selecting HTML elements and performing some action on the element(s). Basic syntax is: $(selector).action()  A $ sign to define/access jQuery  A (selector) to "query (or find)" HTML elements  A jQuery action() to be performed on the element(s) Syntax:- $(document).action(function(){ // jQuery methods go here... });
  • 10. SELECTING ELEMENTS IN JQUERY(CSS SELECTORS)
  • 11. SELECTING ELEMENTS IN JQUERY(CUSTOM SELECTORS)
  • 12. EXAMPLE OF SELECTORS <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); }); </script> </head> <body> <h2>This is a heading</h2> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button>Click me to hide paragraphs</button> </body> </html> <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#test").hide(); }); }); </script> </head> <body> <h2>This is a heading</h2> <p>This is a paragraph.</p> <p id="test">This is another paragraph.</p> <button>Click me</button> </body> </html>
  • 13. EXAMPLE OF SELECTORS(CSS SELECTORS) <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>animated demo</title> <style> div { background: yellow; border: 1px solid #AAA; width: 80px; height: 80px;margin: 0 5px;float: left;} div.colored {background: green;}</style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script></head><body> <button id="run">Run</button> <div></div> <div id="mover"></div><div></div><script> $( "#run" ).click(function() { $( "div:animated" ).toggleClass( "colored" );});function animateIt() { $( "#mover" ).slideToggle( "slow", animateIt );} animateIt(); </script> </body> </html>
  • 16. EXAMPLE OF CSS STYLES USING JQUERY <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("input").focus(function(){ $(this).css("background-color", "#cccccc"); }); $("input").blur(function(){ $(this).css("background-color", "#ffffff"); }); }); </script> </head> <body> Name: <input type="text" name="fullname"><br> Email: <input type="text" name="email"> </body> </html>
  • 17. EXAMPLE OF CSS STYLES USING JQUERY <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").on({ mouseenter: function(){ $(this).css("background-color", "lightgray"); }, mouseleave: function(){ $(this).css("background-color", "lightblue"); }, click: function(){ $(this).css("background-color", "yellow"); } });}); </script> </head> <body> <p>Click or move the mouse pointer over this paragraph.</p> </body> </html>
  • 18. EXAMPLE OF CSS STYLES USING JQUERY <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").on({ mouseenter: function(){ $(this).css("background-color", "lightgray"); }, mouseleave: function(){ $(this).css("background-color", "lightblue"); }, click: function(){ $(this).css("background-color", "yellow"); } });}); </script> </head> <body> <p>Click or move the mouse pointer over this paragraph.</p> </body> </html>
  • 19. JQUERY EVENTS All the different visitor's actions that a web page can respond to are called events. An event represents the precise moment when something happens. Examples:  moving a mouse over an element  selecting a radio button  clicking on an element
  • 20. JQUERY EVENTS Mouse Events Keyboard Events Form Events Document/Window Events click keypress submit load dblclick keydown change resize mouseenter keyup focus scroll mouseleave blur unload
  • 21. JQUERY EVENTS Mouse Events Keyboard Events Form Events Document/Window Events click keypress submit load dblclick keydown change resize mouseenter keyup focus scroll mouseleave blur unload
  • 22. JQUERY EVENTS(MOUSE) -> CLICK <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); </script> </head> <body> <p>If you click on me, I will disappear.</p> <p>Click me away!</p> <p>Click me too!</p> </body>
  • 23. JQUERY EVENTS(MOUSE) -> DBL CLICK <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").dblclick(function(){ $(this).hide(); }); }); </script> </head> <body> <p>If you double-click on me, I will disappear.</p> <p>Click me away!</p> <p>Click me too!</p> </body> </html>
  • 24. JQUERY EVENTS(MOUSE) -> MOUSE ENTER <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#p1").mouseenter(function(){ alert("You entered p1!"); }); }); </script> </head> <body> <p id="p1">Enter this paragraph.</p> </body> </html>
  • 25. JQUERY EVENTS(MOUSE) -> HOVER <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#p1").hover(function(){ alert("You entered p1!"); }, function(){ alert("Bye! You now leave p1!"); }); }); </script> </head> <body> <p id="p1">This is a paragraph.</p> </body> </html>
  • 26. JQUERY EVENTS(MOUSE) -> BLUR <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#p1").hover(function(){ alert("You entered p1!"); }, function(){ alert("Bye! You now leave p1!"); }); }); </script> </head> <body> <p id="p1">This is a paragraph.</p> </body> </html>
  • 28. HIDE WITH SPEED <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").hide(1000); }); }); </script> </head> <body> <button>Hide</button> <p>This is a paragraph with little content.</p> <p>This is another small paragraph.</p> </body> </html>
  • 31. FADEIN() <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeIn(); $("#div2").fadeIn("slow"); $("#div3").fadeIn(3000) ; }); }); </script> </head> <body> <p>Demonstrate fadeIn() with different parameters.</p> <button>Click to fade in boxes</button><br><br> <div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div><br> <div id="div2" style="width:80px;height:80px;display:none;background-color:green;"></div><br> <div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div> </body></html>
  • 32. FADEOUT() <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeOut(); $("#div2").fadeOut("slow"); $("#div3").fadeOut(3000); }); }); </script></head> <body> <p>Demonstrate fadeOut() with different parameters.</p> <button>Click to fade out boxes</button><br><br> <div id="div1" style="width:80px;height:80px;background-color:red;"></div><br> <div id="div2" style="width:80px;height:80px;background-color:green;"></div><br> <div id="div3" style="width:80px;height:80px;background-color:blue;"></div></body></html>
  • 33. FADEIN() & FADEOUT() <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeToggle(); $("#div2").fadeToggle("slow"); $("#div3").fadeToggle(3000); }); }); </script> </head><body> <p>Demonstrate fadeToggle() with different speed parameters.</p> <button>Click to fade in/out boxes</button><br><br> <div id="div1" style="width:80px;height:80px;background-color:red;"></div><br> <div id="div2" style="width:80px;height:80px;background-color:green;"></div><br> <div id="div3" style="width:80px;height:80px;background-color:blue;"></div></body></html>
  • 34. SLIDE <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideToggle("slow"); }); }); </script> <style> #panel, #flip { padding: 5px; text-align: center; background-color: #e5eecc; border: solid 1px #c3c3c3; }#panel { padding: 50px; display: none;}</style></head><body> <div id="flip">Click to slide the panel down or up</div> <div id="panel">Hello world!</div> </body> </html>
  • 35. ANIMATION <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").animate({ left: '250px', height: '+=150px', width: '+=150px' }); }); });</script> </head><body> <button>Start Animation</button> <p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p> <div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div> </body> </html>
  • 36. ANIMATION <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").animate({ height: 'toggle' }); }); }); </script> </head> <body> <p>Click the button multiple times to toggle the animation.</p> <button>Start Animation</button> <p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p> <div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div> </body> </html>