Thursday, July 8, 2010

jQuery, Frist Steps

This tutorial and next ones assumes that you have a previous basic understanding of Html, JavaScript, CSS.

In order to use jQuery you have to load it. To do that you can download it from Here.(version 1.4.2). Please visit http://jquery.com/ for previous and updated versions.
Another way you could use jQuery without storing it onto your computer is to load the CDN jQuery core file from Google or Microsoft.

Please be aware that you can choose to either put your JavaScript or CSS code on the same HTML file or you can create separate files for both JavaScript andd CSS and then link them into your HTML file.

In the next example you will find a basic structure of a HTML document, with sections for both CSS and JavaScript / jQuery code inside Click on the appropriate button to either see the Script or the Demo.










<html>
<head>
<style type='text/css'>

HERE GOES CSS CODE

</style>

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script type='text/javascript'>

$(document).ready(function(){

HERE GOES jQuery CODE...

}) ;

</script>
</head>

<body>
HERE GOES HTML CODE
</body>
</html>




HERE GOES HTML CODE



When working with jQuery, you will notice that most of the codding goes inside a:

$(document).ready(function(){

HERE GOES jQuery CODE...

}) ;
 
in order to prevent to run the jQuery Code before the document in fully loaded.

No comments:

Post a Comment