Wednesday, March 18, 2009

JQuery Tips For Beginners

A week or so ago, I really started to use JQuery on larger scale applications. Below are some of the things I ran in to. Hopefully this will help you in your JQuery projects.

  1. Say no to DataLists. The reason being that they wrap the div tags in unnecessary tables. Using a repeater instead produces cleaner code. Easier to debug your jquery
  2. No spaces un xslt attributes or elements
  3. Intellisense: http://blogs.ipona.com/james/archive/2009/01/14/jquery-1.3-and-visual-studio-2008-intellisense.aspx
  4. Use Firebug to watch expressions
  5. Do not put the minus sign in the id, name or class attributes as running an eval statement will fail. eg. the following will fail
    $('#' + form + ' input, #' + form + ' textarea').each(function(i) { eval("msg." + $(this).attr('name') + " = '" + $(this).val() + "';"); });
  6. Try to keep functionality separated into different .js files instead of grouping them all in one. It makes it easier to debug.
If you have any items to add to this list that will help new users of JQuery please email them to Susan Fischer at susan@clinchportal.com and we will post them here.

No comments:

Post a Comment