JQuery how to remove all tags from a

dom-manipulationjquery

I've tried both of the following but none of them worked:

$('#divhtml').remove('span')

$('#divhtml').find('span').remove()

EDIT: $('#divhtml').find('span').remove() worked on 2nd try.

Best Solution

You have already used a correct statement:

$('#divhtml').find('span').remove()

This should work. Please provide more context... See this jsfiddle as "proof" that something else is wrong: http://jsfiddle.net/Pbgqy/