Friday 21 November 2008

Learning Simple JQuery - Part 1.

This example demonstrates using an jQuery id selector on anchor tags to attach a click event. It also uses an id selector to attach the slideDown and slideUp JQuery functions to a html div element. Add following click handlers to page using console in FireBug
  • $("#lnkShowLoginBox").click(showLoginBox);
  • $("#lnkHideLoginBox").click(hideLoginBox);
 
function showLoginBox(e) {  
   e.preventDefault();  
   console.log('in fn. showLoginBox');  
   $("#PaulsPointLoginBox").slideDown("slow");  
 }  
   
 function hideLoginBox(e) {  
   e.preventDefault();  
   console.log('in fn. hideLoginBox');  
   $("#PaulsPointLoginBox").slideUp("slow");  
 }  
This simple JQuery example was taken from Stephen Walthers PDC 2008 talk.
http://channel9.msdn.com/pdc2008/
http://channel9.msdn.com/pdc2008/PC31/

No comments: