contains will work with or without quote around 'mytext'. How do I know it works? because $("#tableid tbody tr td.someclass:contains (mytext)").dosomething(); is working just fine for selecting td (as well as with 'mytext' quoted) but as soon as the tr:has (td.comeclass:contains(mytext)) is added (regardless of 'mytext' quoted or not, i tried both) the tr is not selected (which is what I want, i dont want to select td)
I thought about just selecting the td and then .parent() it but I try not to use any destructive operation if I could. Is my selector construct simply not supported by jquery or is it a bug in 1.3.1? I haven't tried it with the 1.2.6. On Feb 11, 7:46 am, Michael Lawson <mjlaw...@us.ibm.com> wrote: > If mytext is a string, make sure it's quoted as said before. Your jquery > selector looks ok (I did something similar recently and it works great) > > cheers > > Michael Lawson > Content Tools Developer, Global Solutions, ibm.com > Phone: 1-919-517-1568 Tieline: 255-1568 > E-mail: mjlaw...@us.ibm.com > > 'Examine my teachings critically, as a gold assayer would test gold. If you > find they make sense, conform to your experience, and don't harm yourself > or others, only then should you accept them.' > > From: SteelRing <steelr...@gmail.com> > > > To: "jQuery (English)" <jquery-en@googlegroups.com> > > > Date: 02/10/2009 05:51 PM > > > Subject: [jQuery] Re: using :has with selector > > > This is going to select the td, whereas I need to select the tr. > > On Feb 10, 4:41 pm, "Mauricio \(Maujor\) Samy Silva" > > <css.mau...@gmail.com> wrote: > > TD is a TR children so use the CSS descendant selector tr td. > > > $("#tableid tbody tr td.someclass:contains('mytext'))").dosomething(); > > > PS: mytext is a string and should be quoted. > > > Maurício > > > -----Mensagem Original----- > > De: "SteelRing" <steelr...@gmail.com> > > Para: "jQuery (English)" <jquery-en@googlegroups.com> > > Enviada em: terça-feira, 10 de fevereiro de 2009 19:57 > > Assunto: [jQuery] using :has with selector > > > > Anyone can think of a reason why this shouldn't work? I'm trying to > > > select the Row (tr) where the cell of td with class "someclass" > > > contains "mytext". Since I want to work on the row (tr) itself, I need > > > to use :has because I don't need to select the td itself. Am I wrong > > > or am I wrong? > > > > $("#tableid tbody tr:has(td.someclass:contains(mytext))").dosomething > > > (); > > > > graycol.gif > < 1KViewDownload > > ecblank.gif > < 1KViewDownload