Javascript find()从存储在变量中的my HTML中删除立即标记

Javascript find()从存储在变量中的my HTML中删除立即标记,javascript,jquery,html,Javascript,Jquery,Html,我有这个HTML <div id='add_more_edu'> <div class='one_exp'> --- many INPUT and SELECT elements with disabled attribute </div> </div> 字段被成功禁用,但我在.edu_history_div中附加的内容如下 <div id='add_more_edu'> --- many INPUT and S

我有这个HTML

<div id='add_more_edu'>
 <div class='one_exp'>
    --- many INPUT and SELECT elements with disabled attribute
 </div>
</div>
字段被成功禁用,但我在.edu_history_div中附加的内容如下

<div id='add_more_edu'>

    --- many INPUT and SELECT elements with disabled attribute

</div>
那只猫消失了

如果我评论第2行,则不会消失

解决办法是什么

除此之外还有其他选择吗 edu_contect=$edu_contect.findinput,选择.removeAttr'disabled'

我试过了

$edu_contect.findinput,选择.removeAttr'disabled'

也可以,但禁用的属性不会从input和select中删除,

在$edu_contect上的find只返回匹配的元素,在您的情况下,这些元素是input和select,并存储在edu_contect=..行上的edu_contect中

此外,这里不需要html,因为可以对.clone返回的对象执行append和find等其他操作

使用以下命令

var edu_contect = $("#add_more_edu").clone();
edu_contect.find("input,select").removeAttr('disabled')
$('.edu_history_div').append(edu_contect);

那太完美了。。。作品但是请解释你删除.html并使用edu_contect而不是$edu_contectedu_contect=$edu_contect.find的背后的逻辑。。。仅保存/分配在edu_contect中找到的元素。由于需要附加克隆元素时不需要html,所以我从edu_contect中删除了$
var edu_contect = $("#add_more_edu").clone();
edu_contect.find("input,select").removeAttr('disabled')
$('.edu_history_div').append(edu_contect);