Friday, September 23, 2011

Example1.1 - Test jQuery configuration

This is the example for for testing whether the jQuery configured properly or not
Steps:
1. As i mentioned in my previous blog, Download the jQuery java script file latest version.
2. Create a sample HTML file and include the following code.


3. Save the HTML and open the file on any browser to see the output.

if we see the code, we can clearly observe three  sections of code.
one is plain HTML code which defines the view or structure.
second is the JavaScript code. Actually, this is the jQuery code. In jQuery, functions are the first class objects. We can move this code to a java script file and we can mention the source in the script tag. This script defines the behavior.
third part is the styling part.This defines the presentation.
Actually, this is one of the best practice to separate these parts.

the symbol $ indicates the query object. As i said, we can use this object as function also. See this sample code (source: Wrox publications)

the ready function is equivalent to onLoad event in Java Script.

No comments:

Post a Comment