jQuery is all around you. You see it on hugely popular sites such as Twitter and Facebook. When you visit Yahoo! or Google, there it is. Someone’s Aunt Mary has a snazzy Web site with jQuery effects for her pet photography business. But there you are, using animated gifs. Your site looks dated, and you aren’t keeping up with your competition. It’s time for you to add the power of jQuery to your site.
You can download jquery at Jquery website. Click here to download
To create your page, do the following:
1. Open the text editor or HTML editor of your choice.
2. Type the following code into the text document:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> <html> <head> <title>My Test Page</title> <script type=”text/javascript” src=”js/jquery-1.4.min.js”></script> <script type=”text/javascript”> $(document).ready(function(){ //Do things here alert($(‘img’).attr(‘alt’)); }); </script> </head> <body> <p>This is my test page.</p> <img src= “images/home.gif” height=”28” width=”28” alt=”This is a test image.”> </body> </html>
3. Save test.html and view it in your Web browser.
You now see the alt of the image displayed in the alert box.