You asked how to select the element that had both classes: > Is there a way to say that I would like to > adress only the table when it its class is cl1 and cl2?
This does that: $('table.cl1.cl2').addClass('abc'); You also want to know how to select the element which has one class but not the other. This, does that: $('table.cl1:not(table.cl2)').addClass('xyz'); Tested in Firefox 3.0b3/Mac. - jason On Mar 9, 12:16 pm, Johannes Theile <[EMAIL PROTECTED]> 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 > >