Fallenreaper
Fallenreaper

Reputation: 139

jquery selector to select find imgs but NOT images in child divs

I have html in the style of:

<div>
   <div><img /><img /></div>
   <textarea />
</div>
<div>
   <img />
</div>
<div>
   <textarea />
</div>

I noticed that a previously used selector will not work correctly.

$(item).find("input[type!='checkbox'],textarea,img").andSelf().csS("height", x);

as it selects the imgs and in the subdiv.

What is the jquery command not search the children of "div" tags to allow it to select all textareas, inputs NOT checkbocs and child imgs (not in divs)

Upvotes: 1

Views: 218

Answers (1)

Kevin B
Kevin B

Reputation: 95021

You could use ...textarea,>img")... however that is being depreciated. I would do it this way:

$(item).find("input[type!='checkbox'],textarea").css("height",x)
    .end().children("img").andSelf().css("height",x);

Upvotes: 1

Related Questions