SlideShare una empresa de Scribd logo
1 de 40
BDotNet UG Meet
May 12,2012
Nasim Ahmad Ansari
ghnash@gmail.com
   … write ASP.net Application?
   … write non-ASP.net Application like PHP?
   … write javascript?
   … write cascading style sheets (css)
   … enjoy writing javascript?
   … write lots of client side script?
   … Ajax?
 JavaScript Library
 Functionality
     DOM scripting & event handling
     Ajax
     User interface effects
     Form validation
   All for Rapid Web Development
   Powerful JavaScript library
     Simplify common JavaScript tasks
     Access parts of a page
        ▪ using CSS or XPath-like expressions
       Modify the appearance of a page
       Alter the content of a page
       Change the user’s interaction with a page
       Add animation to a page
       Provide AJAX support
   Lightweight – 32kb (Minified )
   Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+) jQuery rescues
    us by working the same in all browsers!
   CSS-like syntax – easy for developers/non-developers to understand
   Intellisense for VS.
   Active developer community
   Extensible – Plugins
   Active Community
   Easier to write jQuery than pure JavaScript
   Microsoft has even elected to distribute jQuery with its Visual Studio tool, and
    Nokia uses jQuery on all its phones that include their Web Runtime component.
   Compared with other toolkits that focus heavily on clever JavaScript techniques,
     jQuery aims to change the way that web developers think about creating rich
    functionality in their pages. Rather than spending time juggling the complexities
    of advanced JavaScript, designers can leverage their existing knowledge of
    Cascading Style Sheets (CSS), Hypertext Markup Language (HTML), Extensible
    Hypertext Markup Language (XHTML), and good old straightforward JavaScript
    to manipulate page elements directly, making rapid development a reality.
   As jQuery tag line says “write less do more” 
John Resig
John Resig is the Dean of Computer Science
at Khan Academy and the creator of
the jQuery JavaScript library.
He’s also the author of the
books Pro JavaScript Techniques and
Secrets of the JavaScript Ninja.
Currently, John is located in Boston, MA and
enjoys studying
Ukiyo-e (Japanese Woodblock Printing) in
his spare time.

His Personal Website : http://ejohn.org
   John Resig says “I was, originally, going to
    use JSelect, but all the domain names were
    taken already. I then did a search before I
    decided to call the project jQuery”
 So now you know what is jQuery.
 So what’s next ?
 Are you curious and want to know how to get
  started?
 Then Lets See……. 
   Getting Started
 Download the latest jQuery file from
 http://jquery.com/
   Copy the
    jquery.js
    and the
    jquery-vsdoc.js
    into your application
    folder
   Locally
     <script src="Scripts/jquery-1.7.2.js" ></script>
   Using CDN
     Microsoft
     <script type="text/javascript"
      src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>

     Google
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/
      1.7.2/jquery.min.js"></script>

     Jquery
     <script type="text/javascript"
      src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
 Download Faster (Performance)
 Caching

   What if the CDN is down? – Don’t worry there
    is way 
   <script type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
    </script>

   <script type="text/javascript">
 if(typeof jQuery=='undefined')
    document.write(unscape("%3Cscript src='jQuery.js' type='text/javascript'%3E
    %3C/script%3E"));
</script>
 $() function or jQuery()
 Ready Function
 $(document).ready() – use to detect when a page has
    loaded and is ready to use
   Object Wrapper $(document)
   Call Inline or Named Function – Your choice
   - by Tag Name
   - by ID
   - by Class Name
   - by Attribute Value
   - Input Nodes
   <div id="UserAreaDiv">
         <span class="BoldText"> Nasim Ahmad </span>
    </div>

Selector Syntax
 $(selectorExpression)
 jQuery(selectorExpression)


   Selectors allow Page elements to be selected
   Single or multiple elements are supported
   Selector identifies an HTML element/tag that will
    be manipulated wit jQuery Code
 Very compact than longer “getElementById”
 And its easy


$('div') selects all <div> elements
$('a') selects all <a> elements
$('p') selects all <p> elements
   To reference multiple tags use the , character
    to separate the elements.

$('div,span,p,a')

this will select all div, span, paragraph and
 anchors elements
   $('ancestor descendant') selects all descendants of the
    ancestor.

$('table tr')

    Selects all tr elements that are descendants of the table
    element

   Descendants are children, grandchildren etc of the
    designated ancestor element
Selecting by Element ID

   Use the # character to select elements by ID:

$('#divId')

selects <div id="divId"> element
Selecting Elements by Class Name

   Use the . character to select elements by class name

$('.myClass')

selects <div class="myClass"> element
Selecting By Attribute Value

    Use brackets [attribute] to select based on attribute name
     and/or attribute value

    $('a[title]')

selects all <a> elements that have title attribute

$('a[title="BDotnet UG Link"]')

    selects all anchor element which has a "BDotnet UG Link"
     title attribute value
Selecting Input Elements

    $(':input') selects all input elements :
    input,select,textarea,button,image,radio ,
     etc.. & more

$(':input[type="radio"]')
Modify CSS Classes

   Four methods for working with CSS Class
    attributes are:
   .addClass()
   .hasClass()
   .removeClass()
   .toggleClass()
Adding a CSS Classes
    .addClass() adds one or more class names to the class
     attribute of each matched element

     $('div').addClass('MyClass')

    More than one Class


    $('div').addClass('RedClass BlueClass')
Matching CSS Classes

   .hasClass() returns true if the selected element has a
    matching class.


    if($('p').hasClass('style')){
       //Put your code
    }
Removing CSS Classes

    .removeClass() can remove one or more classes

$('div').removeClass('RedClass BlueClass')

    Remove all class attributes for the matching selector

    $('div').removeClass()
Toggle CSS Classes
   .toggleClass() alternates adding or removing a class based
    on the current presented or absented of the class

$('#UserInfo').toggleClass('setBackgroundColor')

    <style>
     .setBackgroundColor{background:blue;}
    </style>
   each(fn) traverses every selected
    element calling fn()
                  var sum = 0;
               $(“div.number”).each(
                        function(){
                  sum += (+this.innerHTML);
                            });
// select > append to the end
$(“h1”).append(“<li>Hello $!</li>”);
// select > append to the beginning
$(“ul”).prepend(“<li>Hello $!</li>”);

  // create > append/prepend to selector
   $(“<li/>”).html(“9”).appendTo(“ul”);
  $(“<li/>”).html(“1”).prependTo(“ul”);
   $(“h3”).each(function(){
       $(this).replaceWith(“<div>”
                             + $(this).html()
                             + ”</div>”);
       });
   // remove all children
    $(“#DivId”).empty();

    // remove all children
     $(“#DivId”).empty();
    // get window height
     var sWinHeight = $(window).height()

    //set element height
    $('#mainId').height(sWinHeight)

    .width() - element
    .innerWidth() - .width()+padding
    .outerWidth() - .innerWidth()+border
    .outerWidth(true) - include margin
When DOM is ready

      $(document).ready(function(){
       // Write your Code
      });

   It fires when the document is ready for Programming
   It uses advanced listeners for detecting
   window.onload() is a fallback.
Loading Content

$("div").load("ContentPage.html");

   Pass Parameters

$("div").load("getData.aspx“,{"Catid":"10"});
GET/POST Requests

$.get("getData.aspx",{Catid:10},
   function(data){
   //write your code
   }
)

$.post("getData.aspx",{Catid:10},
   function(data){
   //write your code
   }
)
Retrieving JSON Data

$.getJSON("getData.aspx",{CatId:10},
    function(categories){
   //alert(categories[0].Name);
})
Questions ?

Más contenido relacionado

La actualidad más candente

A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuerySudar Muthu
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4Heather Rock
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQueryAngel Ruiz
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery BasicsKaloyan Kosev
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009Remy Sharp
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery PresentationRod Johnson
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoiddmethvin
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 

La actualidad más candente (20)

Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery Basics
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
J query training
J query trainingJ query training
J query training
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
jQuery
jQueryjQuery
jQuery
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 

Destacado

Correcting without being critical
Correcting without being criticalCorrecting without being critical
Correcting without being criticalSafrin Sadik
 
Get protection from computer radiations
Get protection from computer radiationsGet protection from computer radiations
Get protection from computer radiationsSafrin Sadik
 
Project hayoung
Project   hayoungProject   hayoung
Project hayoung15hso1
 
The venice presentation
The venice presentationThe venice presentation
The venice presentationnicacervantes
 

Destacado (7)

Protect your back
Protect your backProtect your back
Protect your back
 
Correcting without being critical
Correcting without being criticalCorrecting without being critical
Correcting without being critical
 
Get protection from computer radiations
Get protection from computer radiationsGet protection from computer radiations
Get protection from computer radiations
 
Project hayoung
Project   hayoungProject   hayoung
Project hayoung
 
The venice presentation
The venice presentationThe venice presentation
The venice presentation
 
Forbeswood parklane
Forbeswood parklaneForbeswood parklane
Forbeswood parklane
 
The bellagio ii pdf
The bellagio ii pdfThe bellagio ii pdf
The bellagio ii pdf
 

Similar a J query b_dotnet_ug_meet_12_may_2012

How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuerykolkatageeks
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentationMevin Mohan
 
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 .NETJames Johnson
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Thinqloud
 
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 .NETJames Johnson
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkIndicThreads
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Frameworkvhazrati
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)Oswald Campesato
 

Similar a J query b_dotnet_ug_meet_12_may_2012 (20)

How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuery
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Jquery
JqueryJquery
Jquery
 
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
 
jQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusionjQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusion
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...
 
jQuery
jQueryjQuery
jQuery
 
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
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Jquery
JqueryJquery
Jquery
 
J Query Public
J Query PublicJ Query Public
J Query Public
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
JQuery
JQueryJQuery
JQuery
 
Web2 - jQuery
Web2 - jQueryWeb2 - jQuery
Web2 - jQuery
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

J query b_dotnet_ug_meet_12_may_2012

  • 1. BDotNet UG Meet May 12,2012 Nasim Ahmad Ansari ghnash@gmail.com
  • 2. … write ASP.net Application?  … write non-ASP.net Application like PHP?  … write javascript?  … write cascading style sheets (css)  … enjoy writing javascript?  … write lots of client side script?  … Ajax?
  • 3.
  • 4.  JavaScript Library  Functionality  DOM scripting & event handling  Ajax  User interface effects  Form validation  All for Rapid Web Development
  • 5. Powerful JavaScript library  Simplify common JavaScript tasks  Access parts of a page ▪ using CSS or XPath-like expressions  Modify the appearance of a page  Alter the content of a page  Change the user’s interaction with a page  Add animation to a page  Provide AJAX support
  • 6. Lightweight – 32kb (Minified )  Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+) jQuery rescues us by working the same in all browsers!  CSS-like syntax – easy for developers/non-developers to understand  Intellisense for VS.  Active developer community  Extensible – Plugins  Active Community  Easier to write jQuery than pure JavaScript  Microsoft has even elected to distribute jQuery with its Visual Studio tool, and Nokia uses jQuery on all its phones that include their Web Runtime component.  Compared with other toolkits that focus heavily on clever JavaScript techniques, jQuery aims to change the way that web developers think about creating rich functionality in their pages. Rather than spending time juggling the complexities of advanced JavaScript, designers can leverage their existing knowledge of Cascading Style Sheets (CSS), Hypertext Markup Language (HTML), Extensible Hypertext Markup Language (XHTML), and good old straightforward JavaScript to manipulate page elements directly, making rapid development a reality.  As jQuery tag line says “write less do more” 
  • 7. John Resig John Resig is the Dean of Computer Science at Khan Academy and the creator of the jQuery JavaScript library. He’s also the author of the books Pro JavaScript Techniques and Secrets of the JavaScript Ninja. Currently, John is located in Boston, MA and enjoys studying Ukiyo-e (Japanese Woodblock Printing) in his spare time. His Personal Website : http://ejohn.org
  • 8. John Resig says “I was, originally, going to use JSelect, but all the domain names were taken already. I then did a search before I decided to call the project jQuery”
  • 9.  So now you know what is jQuery.  So what’s next ?  Are you curious and want to know how to get started?  Then Lets See……. 
  • 10. Getting Started
  • 11.  Download the latest jQuery file from  http://jquery.com/
  • 12. Copy the jquery.js and the jquery-vsdoc.js into your application folder
  • 13. Locally  <script src="Scripts/jquery-1.7.2.js" ></script>  Using CDN  Microsoft  <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>  Google  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/ 1.7.2/jquery.min.js"></script>  Jquery  <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
  • 14.  Download Faster (Performance)  Caching  What if the CDN is down? – Don’t worry there is way   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>  <script type="text/javascript"> if(typeof jQuery=='undefined') document.write(unscape("%3Cscript src='jQuery.js' type='text/javascript'%3E %3C/script%3E")); </script>
  • 15.
  • 16.  $() function or jQuery()  Ready Function  $(document).ready() – use to detect when a page has loaded and is ready to use  Object Wrapper $(document)  Call Inline or Named Function – Your choice
  • 17. - by Tag Name  - by ID  - by Class Name  - by Attribute Value  - Input Nodes
  • 18. <div id="UserAreaDiv"> <span class="BoldText"> Nasim Ahmad </span> </div> Selector Syntax  $(selectorExpression)  jQuery(selectorExpression)  Selectors allow Page elements to be selected  Single or multiple elements are supported  Selector identifies an HTML element/tag that will be manipulated wit jQuery Code
  • 19.  Very compact than longer “getElementById”  And its easy $('div') selects all <div> elements $('a') selects all <a> elements $('p') selects all <p> elements
  • 20. To reference multiple tags use the , character to separate the elements. $('div,span,p,a') this will select all div, span, paragraph and anchors elements
  • 21. $('ancestor descendant') selects all descendants of the ancestor. $('table tr') Selects all tr elements that are descendants of the table element  Descendants are children, grandchildren etc of the designated ancestor element
  • 22. Selecting by Element ID  Use the # character to select elements by ID: $('#divId') selects <div id="divId"> element
  • 23. Selecting Elements by Class Name  Use the . character to select elements by class name $('.myClass') selects <div class="myClass"> element
  • 24. Selecting By Attribute Value  Use brackets [attribute] to select based on attribute name and/or attribute value $('a[title]') selects all <a> elements that have title attribute $('a[title="BDotnet UG Link"]') selects all anchor element which has a "BDotnet UG Link" title attribute value
  • 25. Selecting Input Elements  $(':input') selects all input elements : input,select,textarea,button,image,radio , etc.. & more $(':input[type="radio"]')
  • 26. Modify CSS Classes  Four methods for working with CSS Class attributes are:  .addClass()  .hasClass()  .removeClass()  .toggleClass()
  • 27. Adding a CSS Classes  .addClass() adds one or more class names to the class attribute of each matched element $('div').addClass('MyClass')  More than one Class $('div').addClass('RedClass BlueClass')
  • 28. Matching CSS Classes  .hasClass() returns true if the selected element has a matching class. if($('p').hasClass('style')){ //Put your code }
  • 29. Removing CSS Classes  .removeClass() can remove one or more classes $('div').removeClass('RedClass BlueClass')  Remove all class attributes for the matching selector $('div').removeClass()
  • 30. Toggle CSS Classes  .toggleClass() alternates adding or removing a class based on the current presented or absented of the class $('#UserInfo').toggleClass('setBackgroundColor') <style> .setBackgroundColor{background:blue;} </style>
  • 31. each(fn) traverses every selected element calling fn() var sum = 0; $(“div.number”).each( function(){ sum += (+this.innerHTML); });
  • 32. // select > append to the end $(“h1”).append(“<li>Hello $!</li>”); // select > append to the beginning $(“ul”).prepend(“<li>Hello $!</li>”); // create > append/prepend to selector $(“<li/>”).html(“9”).appendTo(“ul”); $(“<li/>”).html(“1”).prependTo(“ul”);
  • 33. $(“h3”).each(function(){ $(this).replaceWith(“<div>” + $(this).html() + ”</div>”); });
  • 34. // remove all children $(“#DivId”).empty(); // remove all children $(“#DivId”).empty();
  • 35. // get window height var sWinHeight = $(window).height()  //set element height $('#mainId').height(sWinHeight)  .width() - element  .innerWidth() - .width()+padding  .outerWidth() - .innerWidth()+border  .outerWidth(true) - include margin
  • 36. When DOM is ready $(document).ready(function(){ // Write your Code });  It fires when the document is ready for Programming  It uses advanced listeners for detecting  window.onload() is a fallback.
  • 37. Loading Content $("div").load("ContentPage.html");  Pass Parameters $("div").load("getData.aspx“,{"Catid":"10"});
  • 38. GET/POST Requests $.get("getData.aspx",{Catid:10}, function(data){ //write your code } ) $.post("getData.aspx",{Catid:10}, function(data){ //write your code } )
  • 39. Retrieving JSON Data $.getJSON("getData.aspx",{CatId:10}, function(categories){ //alert(categories[0].Name); })