montrealmike
montrealmike

Reputation: 11641

How to use jquery to select all the children of an element as well as all images

$('img, div.name < *')

Only returns the first children but i need all of them. I can do it in two statements, but i need to do it in one since i want to :not the expression.

:not ( $('div.name').children() + $('img') )

Is what i'm trying to achieve. Thanks!

Upvotes: 1

Views: 2241

Answers (2)

hunter
hunter

Reputation: 63562

If you're trying to select descendants, not just direct children, use *

$('img, div.name *')

> will only get you the direct children of that object, but it might not matter

Upvotes: 0

jAndy
jAndy

Reputation: 236202

$('div.name > *, img');

should do it.

Upvotes: 1

Related Questions