Online PHP editor is going to be changed...

We are going to:

  1. Redesign the site
  2. Work with SSH instead of FTP
  3. Switch to HTTPS
  4. Work without "session" to improve security
  5. And, of course, remain open source

Please consider...

  1. Checking our new PHP blog
  2. Visit the new Facebook page


I'm using SSH and I will continue using online-php.com

<? Online-PHP::Tutorials ?>

« Back

  • jQuery performance tips

    jQuery Tips

    So here are some of the important points:

    • Use direct ID in the selector
      instead of $('#div .class') use $('#div_class')
       
    • Add tags before class name in the selector
      instead of $('#div .class') use $('#div span.class')
       
    • Create local vars for JQ objects which are accessed more than once
      var obj = $('div span.class');
      obj.bind('click', clickSpan);
      obj.css('background', 'red');

       
    • Use For instead of Each
       
    • Use .html() instead of DOM manipulations, when possible
       
    • Reduce elements on event binding - Use event.target instead of binding event to many items within a container
      instead of
      $('#my_list li').bind('click', ...)
      use
      $('#my_list').bind('click', function(e) {
        var elem = $(e.target);
        if (e.target.nodeName == 'LI') {
          ...
        }
      }

       
    • Use $(window).load(...) instead of $(document).ready(...)
       
    • Pull elements off the DOM, manupulate, and than return them back

     

    References:

    http://www.artzstudio.com/2009/04/jquery-performance-rules/
    http://jonraasch.com/blog/10-advanced-jquery-performance-tuning-tips-from-paul-irish

     

    Enjoy,
    Gregory C.