Good point.

I've just tested "input[value='']" and got an error in jQuery.js. Just
tested it with other HTML attributes and got the same results.
Empty attributes are not selected with a "element[attr]" and doing a
"element[attr='']" results in an error.
Is this a bug?


by(e)
Stephan


2009/2/4 Adrian Lynch <adely...@googlemail.com>:
>
> Nice one! Should have spotted :has()...
>
> I've asked this in another thread but I'll slip it in here too, does
> the selector...
>
> input[value='']
>
> ... work for any of you?
>
> Adrian
>
> On Feb 4, 12:11 pm, Stephan Veigl <stephan.ve...@gmail.com> wrote:
>> 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

Reply via email to