-->

07 March 2021

What is JQuery

  Asp.Net CS By Example       07 March 2021
What is JQuery?

JQuery is the Javascipt library. JQuery is used for client side-scripting. You can access any element, make animation and validate input by using the JQuery library No extra code can achieve the result by writing one or few lines of code instead of writing dozen lines of codes. You can handle the events easily in the html document; get fast results from server using Ajax and so on..

History :

jQuery was first released in January 2006 by John Resig at BarCamp NYC. It is currently headed by Timmy Wilson and maintained by a team of developers. Nowadays, jQuery is widely used technology. Most of the websites are using jQuery

Why use Bootstrap?

 🚦 It helps to run with all kind of browsers and is compatible various browsers.
 🚦 It helps to implement critical functionality without writing hundreds of line of codes.
 🚦 It is fast to implement customized action.

Know more JQuery

 🚦 http://learn.jquery.com.
 🚦 http://api.jquery.com.
 🚦 http://forum.jquery.com.
 🚦 http://www.websprogram.com.

Download JQuery

 🚦 http://jquery.com/download.

You can use jQuery in two ways:
(1) Download and Use files:
 🚦 If you want to use jQuery file locally, then download it. Download jQuery from http://jquery.com/download , put the downloaded file in the same folder with your jQuery files, and reference it in your code.
 <head>
      <script src="jquery-1.11.3.js"> </script>                
 </head>

(2) Another way to include files is with CDN:
 🚦 In this method, we do not need to download files, but provide links of these files. Note that in this case the code will not work in offline mode.
The Content Delivery Network (CDN) is a way to host popular libraries in the cloud and in Allow developers to access these files directly when needed. There are some Popular CDN service providers, such as Google Hosted Libraries (https://developers.google.com/speed/libraries/devguide), cdnjs (http://cdnjs.com/), Cloudflare (http://www.cloudflare.com/) and others. jquery also supports CDN. They have organized both CSS and Javascript File in their own Bootstrap Cloud Server (https://www.bootstrapcdn.com/). At this point, let's try to use the CDN in the HTML Document.
 <head>
      <script src="http://code.jquery.com/jquery-latest.js"> </script>                
 </head>

First jQuery script Program

Now you can write the first jQuery script. Create a new html document named "jqscript1.html".

jqscript1.html
<html>
<head>
    <title>jQuery Hello World</title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#divMsg").html("JQuery Hello World !");
        });
    </script>
</head>
<body>
    <div id="divMsg" />
</body>
</html>

  Save file with named jqscript1.html and run it by any browser, you will see the result:
Output:

Explanation:
  1) <script src = "http://code.jquery.com/jquery-latest.js"></script> means to use jQuery code in current document.
  2) $(document).ready (function ( ){ }) means to run the function automatically when the web page is completely loaded.
  3) $("#divMsg") accesses the tag whose id is "divMsg".
  4) html( ) displays the contents.
  5) $("#divMsg").html("Hello World !") displays "Hello World!" in a tag whose id is "divMsg".
  6) <div id="divMsg"> defines a tag named "divMsg" where some contents will be shown.
logoblog

Thanks for reading What is JQuery

Previous
« Prev Post

No comments:

Post a Comment

Please do not enter any spam link in the comment box.