Gerry Danen wrote: > Hello Jake, > > I'm an IT veteran (36 years) but rather new to JavaScript, AJAX and all > that. You voice rather strong opinions on this particular subject, and I > love to learn. Is there any chance of a tutorial or example page on this? > > Or, maybe there is an example already?
There is a reason that there is an id as well as a class attribute. These attributes are semantically different. That means one should use them where appropriate and not because one is feeling "stronger" by using classes. The id attribute also has some more functionality then simply being a selector hook. http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.2 Maybe sometimes you will want to use an id simply because it will make your script much faster - at least with jQuery 1.0 ;-) I don't like such generalised statements like the one in the subject of this thread. They're misleading, especially for newcomers (and I wouldn't expect these from teachers). Classitis anyone? Apart from that it isn't correct in a sense either. If you're keen on avoiding unnecessary attributes for selecting things by a selector, you should be able to do it without classes via the pure document structure. But because IE6 doesn't support advanced CSS2 selectors, for styling you will have to use ids and classes in your document anyway, if you want to support that browser that is. So choose the names for them wisely (avoid presentational naming) and use context whenever possible (avoid classitis). I think the Prototype library has pushed some bad practice for extensive id usage because until they got the $$ selector function ids were used for everything. Ok, actually it's not the fault of prototype - if jQuery wouldn't have had the selectors it would have been the same with jQuery. It's just that Prototype is being used by a lot more people. I have seen this with developers switching from Prototype to jQuery. They tend to use ids instead of using the capacities of the selector engine. -- Klaus _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/