Question

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.

Was it helpful?

Solution

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

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

Working jsFiddle here

OTHER TIPS

.field input[type="checkbox"]

Maybe like this?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top