javascript - find() removes the immediate tag from my HTML stored in a variable -
i have html
<div id='add_more_edu'> <div class='one_exp'> --- many input , select elements disabled attribute </div> </div> and have button on page, when clicked, function called, function's code looks this.
var edu_contect = $("#add_more_edu").clone().html(); // line # 2 edu_contect = $(edu_contect).find("input,select").removeattr('disabled'); $('.edu_history_div').append(edu_contect); the fields disabled content appended in .edu_history_div
<div id='add_more_edu'> --- many input , select elements disabled attribute </div> the <div class='one_exp'> gets disappear.
if comment line # 2 <div class='one_exp'> not disappear.
what solution?
or
any alternative line edu_contect = $(edu_contect).find("input,select").removeattr('disabled');???
i have tried
$(edu_contect).find("input,select").removeattr('disabled');
and <div class='one_exp'> okay disabled attribute not removed input , select
the find() on $(edu_contect) returns matching elements in case input , select , these stored in edu_contect on line edu_contect = ....
also, html() not required here, append() , other operations find() can performed on object returned .clone().
use following
var edu_contect = $("#add_more_edu").clone(); edu_contect.find("input,select").removeattr('disabled') $('.edu_history_div').append(edu_contect);
Comments
Post a Comment