jquery - How can I target a div based on the image src container within? -


i new jquery, , wondering if it's possible select div based on image's source contained within? , remove entire div if finds instance?

so in example how through div's class of thumbnail image

src="http://demo.com/wp-content/themes/thestyle/timthumb.php?src=&h=180&w=222&zc=1&q=90"

and delete divs?

<div class="thumbnail">     <a href="http://www.demo.com">         <img src="http://demo.com/wp-content/themes/thestyle/timthumb.php?src=&amp;h=180&amp;w=222&amp;zc=1&amp;q=90">     </a>     <div class="date">         january 1st     </div> </div> 

use :contains selector.

$('div.thumbnail:contains(img[src="http://example.com/foo/bar"])').remove(); 

or select <img> , use .closest():

$('img[src="http://example.com/foo/bar"]').closest('div.thumbnail').remove(); 

learn dig through jquery api docs. they'll answer 99% of questions.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -