Log In | Register | March 29, 2023


jQuery Programming - August 31, 2010

Using jQuery In Your Website

For jQuery to work the elements on the page must be ready for it to be manipulated and used.  Only once the DOM is loaded is when jQuery can then take effect. In order to start using jQuery we must include two things. One is the latest jQuery file which can be downloaded from the jQuery.com website, or also included directly from the Google code repository. The second thing you need to do is include a standard function that will prepare the browser for our jQuery commands.

The code is

$(document).ready(function() {
alert(‘You have successfully loaded jQuery’);

The code above is informing the browser that when the document is ready to run whatever is in between the curly brackets. In this case we used

alert(‘You have successfully loaded jQuery’);

which is a regular JavaScript function that issues a message for the user to see.

There is another way to start jQuery. The shorthand version that is as follows

$(function() {
alert(‘You have successfully loaded jQuery’);

The above code will handle exactly the same as the code described previously. It is really up to you to decide which way you prefer. Either way is perfectly acceptable.

Remember that all your code from now on will go within these functions. Without these functions your code will not run.

Post By: | FavoriteLoadingAdd to favorites


Tuesday, August 31, 2010

This is a great Tutorial! Really good for starters.

드림카지노 | www.gkv55.com | DREAMCASINO | 바카라사이트
Thursday, April 2, 2020

Dreamcasino provides quality online casino services with strong funding, friendly service, and operational know-how of Dreamcasino. It offers a variety of events and benefits and is doing its best to grow into the best brand of online casino.

Leave a Comment

Need Help? Ask a Question

Ask anything you want from how to questions to debug. We're here to help.

You Must Be Logged In To Post A Question.

Log In or Register