Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Brief Introduction to jQuery

A Brief Introduction to jQuery

Old presentation from the archives.

Avatar for James Hughes

James Hughes

October 22, 2010
Tweet

More Decks by James Hughes

Other Decks in Programming

Transcript

  1. Custom  Filters   /*    *    jQuery  Input  Modified

     Filter    */   $.extend($.expr[':'],  {                  modified:  func)on(el)  {                          return  $(el).is("input")  &&  el.defaultValue  !=  el.value;                  }   });     /*  Clear  all  modified  input  elements  */   $("input:modified")  .val(“”);  
  2. Custom  Plugin   /*        *    jQuery

     Zebra  Stripping  Plugin    */   jQuery.fn.zebra  =  funcQon(odd,  even)  {          return  this.find("tr:odd").css("background-­‐color",  odd)                  .end().find("tr:even").css("background-­‐color",  even);   }    //or  $.fn.extend({  zebra  :  funcQon(){…}  })     /*  Apply  Stripping  to  all  tables  in  DOM  */   $("table").zebra("#fff",  "#eee");