Saturday, 3 December 2016

jQuery Basics

jQuery is small, light-weight,fast javaScript library.

 Application -
1. Html manipulation
2. Dom manipulation
3. Css manipulation
4. Html Animation
5. Ajax calling
6. Json parsing 
7. Handling Html events 

How to use - 
1. can be used in .js file or <script> tag inside HTML page
2. use jquery.min.js file or absolute url http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js

$(document).ready()   vs  Window.onload() -
$(document).ready()  is as same as $() 

           $() is jQuery event and called before Window.onload().$() gets called as soon as the DOM is ready (which means that the browser has parsed the HTML and built the DOM tree). This allows you to run code as soon as the document is ready to be manipulated.  
            Window.onload() is javaScript event.It called when complete (DOM + images+ frame )is loaded.
Also,$() can be called any number of time but Window.onload() can be called only once.
$() cannot access images and frames .Window.onload() can be used to access the same.

jQuery Selector -
1.By element  -     $(" element ")
2.By element Id -  $(" #id ")
3.By Class -          $(".className")

jQuery Effects -
Display effects - hide()   - hide selected elements
                            show()  - display selected elements
                            toggle() - switches between Hide() and Show()
Sliding effect -    slideDown() - shows element with sliding down.
                            slideUp() - shows element with sliding up.
                            slideToggle() - switches between slideUp() and slideDown()

animate()
delay() - delay showing of element.



 
 


 

No comments:

Post a Comment