Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 12th, 2012  |  syntax: JavaScript  |  size: 0.24 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var div = $("div"), p = $("<p />").appendTo(div);
  2.  
  3. div.data("p", p).click(handler);
  4.  
  5. function handler(event) {
  6.        
  7.         // much faster
  8.         $(this).data("p").css("margin-top", 100);
  9.        
  10.         // than this
  11.         $(this).children("p").css("margin-top", 100);
  12.        
  13. }