Sunday, March 10, 2013

My first jQuery script


If you downloaded jQuery library (official site) you can start wiriting your first script.

Create new index.html page and paste code between <body> </body> tag.
When page ends loading html code jQuery will start. First you will see JavaScript alert with "This is my first jQuery code" message and after that "Hello World" text will be inserted into "myText" div.


 

Is it simple?
Remember to put jQuery (JavaScript) code in document.ready function because jQuery code have to be started after DOM loads end.

No comments: