What's the best way to remove first div inside a parent div using jQuery? -


i have following markup:

<div id="parent">     <div id="divtoremove">     </div> </div> 

and have following jquery remove first div works fine:

$('#parent').find('div').remove(); 

is best way remove first component? or more efficient use selectors? example great!

please note, know can use:

$('#divtoremove').remove(); 

however i'd able use selectors in instance (reasons outside of scope of question).

thanks, norm.

this should fastest , safest:

$('#parent').find('div').first().remove(); 

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 -