How to delete all divs with at least one child using jquery? -


i want delete divs has @ least 1 child using jquery. example need delete divs containing paragraph 'hello' , 'world'. can 1 please ?

<div style="background:#ff0000;height:200px;width:200px;"> <p> hello </p> </div> <div style="background:#00ff00;height:200px;width:200px; "> </div> <div style="background:#0000ff;height:200px;width:200px;"> </div> <div style="background:#aaaa3a;height:200px;width:200px;"> <p>world </p> </div> 

try :has selector

$('div:has(*)').remove(); 

http://jsfiddle.net/9gdmn/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -