JQUERY
Jquery is a Javascript library which is mainly used to simplify the client-side scripting. Its a cross-browser library. Jquery Supports in all major browser Firefox, IE, Chrome, Opera, Safari. While writing this tutorial final update of Jquery is 1.9.1(stable release). You can download and use Jquery library for any purpose its free and opensource, licensed under MIT.
Uses of Jquery:
- Minimize the Javascript and easy to use when compared to Javascript.
- Select DOM elements, handle events, AJAX, animations are all easily possible in Jquery.
- Extensibility through plug-ins.
- Much faster compare to Javascript coding.
In this Tutorial, before study take a look at CSS (selectors) and HTML and Javascript. We study about Jquery while compare with Javascript with Real time Examples. So all them need just understand the given examples.
Jquery Syntax:$(selector).action();
Starting With Jquery:When you starting with Jquery You must remember the Two main points.
Must include the Jquery library before using the any Jquery functions or events. You must give your Jquery code in some function or ready function.Most of us will get a error will not follow above two points. Download the Library JS from the jquery site click link below and save it.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>.Eg:<!-- This is constant for all so assume it comes automatically in all below examples --><head><script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script></head><!-- This is constant for all so assume it comes automatically in all below examples --><body><script>$(document).ready(function(){$("#firstexample").html("My First");});</script><div id="firstexample"></div></body>
See how jquery difference in Javascript. Try Live Example click here.
In above example, We use CSS selectors inside the $(selectors) element. So its easy to fetch the element compared to Javascript. Learn CSS and CSS selectors tutorial.Class as Selectors.In javascript using class to select a DOM element is very complex, But in Jquery using CSS selectors it is easy to use.Eg:<body><script>$(document).ready(function(){$(".firstdiv").html("Hello world");});</script><div class="firstdiv"></div><div class="firstdiv"></div><div class="firstdiv"></div></body>Note: Use (#) for ids (unique representation). Use (.) for classes (common representation).
Continue in part 2
thank you ,,,,,,,,,,,
ReplyDelete