jessegavin
jessegavin

Reputation: 75650

jQuery selector for <div> which does not contain <img>?

How do I select all <div> elements which do not contain any <img> elements using jQuery?

Upvotes: 7

Views: 4308

Answers (2)

Sithara Augustine
Sithara Augustine

Reputation: 1

$(".className").not(":has(img)")

Upvotes: 0

Tatu Ulmanen
Tatu Ulmanen

Reputation: 124778

$('div:not(:has(img))')

Upvotes: 19

Related Questions