Monthly Archives: July 2010

Rule Zero for writing a JavaScript Widget

If you are adding ID’s you are doing something wrong.

This will cause issues for people who want to have multiple copies of the widget in
the page.  There is to much risk of ID collision.

There is always a way of navigating down the tree to find children (Especially if you
are writing a JQueryUI widget).

Classes are ok – and use them to find children – but DO NOT add an ID.

(This blog post written as a public service, after having seen way to many JQueryUI widgets that don’t get this right).