Hi, just a little remark: add a child selector '>' before the 'input' or you will select surrounding divs as well.
$("div:has(>input[value='2'])") by(e) Stephan 2009/2/4 Mauricio (Maujor) Samy Silva <css.mau...@gmail.com>: > > $('div:has(input[value=2])') > > MaurĂcio > > -----Mensagem Original----- De: "Adrian Lynch" <adely...@googlemail.com> > Para: "jQuery (English)" <jquery-en@googlegroups.com> > Enviada em: quarta-feira, 4 de fevereiro de 2009 09:22 > Assunto: [jQuery] Select element based on a value of its child element > > >> >> Hello all. I have the following... >> >> <div> >> <input type="text" value="1" /> >> </div> >> <div> >> <input type="text" value="2" /> >> </div> >> <div> >> <input type="text" value="3" /> >> </div> >> >> ... and I want to select the second div because its child input has a >> value of 2. >> >> I know I could select the input then come back to the div with parents >> ("div"). Just wondering if there's a way to do it in the selector >> string. >> >> More out of curiosity than need ;) >> >> Thanks. >> >> Adrian > >