JQuery Hello World Example

JQuery Hello World Example

JQuery provides easy access to all html elements. It internally calls Java Script or you can say it’s just a wrapper over Java Scripts. You can download JQuery library (  script file) or use Google CDN hosted library.

Example This is the first example of Jquery for the beginners. Just copy the below code into HTML file and name that file as example.html. Open it in browser to see “Hello world message”.

HTML Code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>Jquery Hello World Example</title>
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script> 
   <script type="text/javascript" language="javascript"> 
   
   $("document").ready(function(){
   
   $("#content").html("Hello world, This is Jquery example.");
   
   });
   
   </script>
    
</head>
<body>
<div id="content">

</div>
</body>
</html>

Description

First we are loading Jquery script library from Google CDN and we are accessing the HTML div element by it’s ID “content” in script. There we used JQuery syntax to access html elements.

On ready state of document we are attaching “Hello world text to content div”.

Tags:

Jquery

Basics of jqueryLearning JqueryJquery hide show div exampleJQuery SlideHow to call function in JQueryJquery Trim StringJQuery Animate Div Height and WidthGoogle JQuery CDNJQuery Form With ValidationHow To Hide Div On Click Using JQueryJquery Dropdown Selected Value

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.