Thứ Ba, 6 tháng 4, 2010

What is Jquery and How it Works




Jquery is a Library fucntion of Javascript.It's very easy to write and very much faster than Javascript. When we use onLoad event handler on body tag ,the onload function will fired when all body content will download successfully ,that means all the image should download completely,then only this event will fired.But in Jquery when your Html DOM(Document Object Model) will load completely than the Jquery function can be fired,it's no need to wait for downloading any Image.That is why it is very nuch popular than other language/script.



For example I am going to give red color into all h1 tag When this page will loaded. For that i will write

<script type="text/javascript">

$(document).ready(function(){

$('h1').css('color','red');

});

</script>



Before Run this script You need to link JQUERY Library into your page which you can get from these links

http://code.jquery.com/jquery-1.4.2.min.js

or you can use this one

http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js


Attach any one of this script then You can see the effect only

Không có nhận xét nào:

Đăng nhận xét