Starting with jquery

Traditionally we use onload attribute in body tag to start page load event or we use window.load=some function in javascript. And for attacthing some event with different elements we have to write attribute(s) with those elements.

 

For example click event with some elements we have to use onclick attribute.
<script language='javascript'>

function Hello(){

alert("Hello");

}
</script>

<input type="button" name="btn" onclick='Hello()' value="Click Me" />
In jquery these things we can be done by using $('document').ready() or $(function(){ }). In jquery generally we use id of element(s) so give id to element(s) which you want to use in script. Syntax for using id in script ("#element_id").event
<script language='javascript'>
 
$('document').ready(function(){
 ("#btn").click(Hello);
 ("#link1").click(Hello);
});
 
function Hello(){
alert("Hello");
}
 
</script>
<input type="button" id="btn" name="btn" value="Click Me" />
and same thing(s) can be done with jquery
 $(function(){

  ("#btn").click(Hello);
  ("#link1").click(Hello);
  });