I want to append HTML of an element, the HTML
consists of different inputs, each of the inputs has an attribute disabled
. How can I remove that attribute before appending?
The following code appends without removing the disabled attribute. If I try something like find('select').removeAttr('disabled');
then it removes all other html and dispalys only that part.
$('button').on('click', function(){
var content = $(this).parent().find('.temp').html();
//content1 = $(content).find('select').removeAttr('disabled');
$('.list').append(content);
});
.temp {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="wrap">
<button>Add</button>
<div class="list">
<p>content</p>
</div>
<div class="temp">
<div class="row">
<select disabled>
<option>Option 1</option>
<option>Option 2</option>
</select>
<input type="text" disabled>
</div>
</div>