问题
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.
回答1:
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/
回答2:
Try this:
$("#divhtml span").remove()
来源:https://stackoverflow.com/questions/8931955/jquery-how-to-remove-all-span-tags-from-a-div