<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "><!--introduced jQuery--><script src=". /scripts/jquery.js "type=" Text/javascript "></script><script type=" Text/javascript ">// Wait for the DOM element to load. $ (document). Ready (function () {alert ("Hello world!");}); </script>1. In the jquery library, $ is a shorthand for jquery, $ ("#foo") and jquery ("#foo") are equivalent, and $.ajax and Jquery.ajax are equivalent.
2.$ (document). Ready (function () {...}); This method is similar to the Window.onload method in traditional JavaScript; All code in the Ready () function will be executed in advance (as long as the DOM is registered in the browser) and not on the page ( The contents of the bandwidth occupied by the sample are fully loaded before the event is executed; it allows the user to immediately see the shadow effect, display effect, and other effects of the element when they first see the element.
The 3.$ (document). Ready () function can be called repeatedly in code.
4.$ (function () {...}); is $ (document). Ready (function () {...}); Short form, the two functions are exactly the same.
5. How to introduce an external CSS file
<link rel= "stylesheet" href= "Css/default.css" type= "Text/css"/>
Comments for 6.jQuery Code
Single-line comment using//method
Multi-line annotations in/*......*/way
jquery Basic Learning 1