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

Viewed 26572

I have the following markup:

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

And I have the following jQuery to remove the first div which works fine:

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

Is this the best way to remove the first component? Or is it more efficient to use selectors? An example would be great!

Please note, I know I can use:

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

however I'd like to be able to use selectors in this instance (reasons outside of scope of question).

Thanks, Norm.

6 Answers
Related