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.
编辑:$('#divhtml')。find('span')。remove()在第二次尝试时工作。
2 个解决方案
#1
25
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/
这应该工作。请提供更多上下文...请将此jsfiddle视为“证明”其他错误:http://jsfiddle.net/Pbgqy/
#2
5
Try this:
$("#divhtml span").remove()
#1
25
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/
这应该工作。请提供更多上下文...请将此jsfiddle视为“证明”其他错误:http://jsfiddle.net/Pbgqy/
#2
5
Try this:
$("#divhtml span").remove()