Pergunta

When using the css selector :has I'm only allowed to put basic properties such as tag name:

.field:has(input)

But not:

.field:has(input[type="checkbox"])

Why is this? I want to select the element of class field, NOT the input.

Foi útil?

Solução

:has isn't a selector in CSS - you are talking about jQuery.

Use: $('.field:has(input[type="checkbox"])');

Working jsFiddle here

Outras dicas

.field input[type="checkbox"]

Maybe like this?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top