jQuery library

jQuery is a new kind of JavaScript Library. It is a fast and concise library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development, and last but not least, is really simple to understand and manipulate.
  • Previous Resource
  • Download
  • Next Resource

Demonstration

Click here...

I would like to demonstrate:

Click here...

How to setup

jQuery is a library that allows you to write javascript in a brand new way.
The first thing you\'ll have to do to use its fantastic possibilities is to include it in the header of your page :

  1. /** jQuery Inclusion **/
  2. <script type="text/javascript" src="Path_to/jQuery.js"></script>

Once this is done, write your javascript code between the following snippet:

  1. jQuery(document).ready(function() {
  2. //Your Code Here.
  3. });

This code can be placed in you page header or in a separate js file. From now on, you\'ll have to pick up the jQuery syntax which is much more concise and efficient than traditional javascript. Here are a few examples:

  1. <script type="text/javascript">
  2. //** jQuery use **/
  3. jQuery(document).ready(function() {
  4. $("#hello").append("<b>The Append Effect</b>");
  5. $("#spanclick1").click(function () {
  6. $("p.hidden").addClass("ohmy").show("slow");
  7. });
  8. $("#spanclick2").click(function () {
  9. $("#fadediv").fadeIn("slow");
  10. });
  11. });
  12. </script>

One of the strentgh of jQuery is how it handles selectors. For example, instead of using a method such as document.getElementById("someid"), jQuery does $("#someid").

Why not having a look a the selector page on the jQuery Official website to have a better understanding of what it can do.

The following code is the html corresponding to the example jQuery code above. The combination of te two gives the results shown in the demonstration.

  1. <span id="spanclick1">Click here...</span>
  2. <p class="hidden">Congratulations!
  3. You just ran a snippet of jQuery code who
  4. <strong>added the class</strong> "test" to that piece of text
  5. and <strong>revealed it</strong>.
  6. </p>
  7.  
  8. <p id="hello">I would like to demonstrate: </p>
  9.  
  10. <span id="spanclick2">Click here...</span>
  11. <div id="fadediv" class="hidden">Fade In Effect</div>

S_ABOVE_CODE_SNIPPET.
S_NICE_AND_EASY.

Why not share this here:

  • Tweet this
  • Buy the author a coffee
  • Bump this
  • Digg this
  • Post this on Del.icio.us
  • Post this on StumbleUpon
  • Post this on Reddit
  • Post this on Technorati
  • Post this on Google
  • Post this on Facebook
  • Email this to a friend

You may also like:

  • jQuery jCarousel Plugin
  • Form Cloning jQuery Plugin
  • A guide to Ajax Interactions with jQuery
  • Wordpress SchmancyBox Plugin
  • Slick Videos Presentation With Fancybox
  • YouTube video manager with PHP, MYSQL & jQuery

Leave a Comment

Posted Comments

jdmweb
Hi schnozz.

Actually in this demonstration, the only style applied specifies that some elements have the class .hidden, which css is as follows:
.hidden {
display: none;
}

Regards. Jeremy
From jdmweb at 13:32 06/10/09 { Reply }
schnozz
can you share the relevant style sheet code with this demonstration
From schnozz at 15:52 01/10/09 { Reply }