Or just use indexes var $tables = $('tables.c1'); $tables.eq(0).addClass('xyz'); $tables.eq(1).addClass('abc');
You could also save some bytes with some chaining. -- Ariel Flesler On 9 mar, 13:36, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Jason's suggestion should work for the first table: > > > $('table.cl1.cl2').addClass('abc'); > > If you want a selector for the second table exclusively, try this: > > $('table.cl1:not(.cl2)').addClass('xyz'); > > --Karl > _________________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Mar 9, 2008, at 12:16 PM, Johannes Theile wrote: > > > > > I think this does not solve the problem. By using > > > $('table.cl1.cl2').addClass('abc'); > > > "abc" is added to Table 1. When I do the same for Table 2: > > > $('table.cl1').addClass('xyz'); > > > "xyz" is also added to Table 1. > > > So I'm looking for something to make a distinction between class="cl1 > > cl2" and class="cl1" to handle it differently. > > > Maybe someone has an idea. > > > Johannes > > > On 9 Mrz., 17:01, Jason Huck <[EMAIL PROTECTED]> wrote: > >> This _should_ work (untested): > > >> $('table.cl1.cl2').addClass('abc'); > > >> - jason > > >> On Mar 9, 11:29 am, Johannes Theile <[EMAIL PROTECTED]> wrote: > > >>> Hi, > >>> I have a page where I cannot change the XHTML code. This page > >>> contains > >>> two tables. The classes of the tables are as following: > > >>> Table 1: <table class="cl1 cl2">....</table> > >>> Table 2: <table class="cl1">....</table> > > >>> Normally to make changes to this tables I would call up something > >>> like: > > >>> $("table.cl1").addClass("abc"); > >>> $("table.cl2").addClass("xyz"); > > >>> But in this case, if I "call up" the table with class "cl1" the > >>> other > >>> one is also affected. Is there a way to say that I would like to > >>> adress only the table when it its class is cl1 and cl2? > > >>> Hopefully it becomes clear for what I'm looking. > > >>> Many thanks! > > >>> Johannes