Lets Start with a Simple Example as usual always the "Hello World"..
Ok, let get start to create a JQuery Hello World
1.Create a Simple HTML Page say MyfirstJqueryProgram.html like below and place it in the folder
where you have placed jquery-1.2.6.min.js file
<html>
<html>
<head>
<title>My First JQuery Program</title>
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#myprogram").html("This is my first Jquery Program saying Hello World");
});
</script>
</head>
<body>
Hi Welcome !!!
<div id="myprogram">
</div>
</body>
</html>
Explanation:
code Part 1 :
The Above piece of code tells the browser to load the JQuery library which is located in the Folder you have created
Code Part 2:
$(document).ready(function(){
$("#myprogram").html("This is my first Jquery Program saying Hello World");
});
Here we are registering a ready event ie whenever the DOM is Ready
$() is a JQuery syntax called jQuery selector
No comments:
Post a Comment
Please Provide your feedback here