I'm currently implementing jQuery chosen in a select element to enhance user experience, however I'm facing an issue when attempting to copy the chosen div to another div using jQuery
$(document).ready(function() {
$(".chosen").chosen({});
$("#movechosen").click(function() {
var chosenHtml = $(".mycontainer").html();
$(".movecontainer").append(chosenHtml);
});
});
<div class="mycontainer" style="background:#ddd">
Container 1: <select class="chosen" multiple>
<option>Select option</option>
<option>USA</option>
<option>Germany</option>
<option>India</option>
<option>China</option>
<option>Canada</option>
<option>Australia</option>
</select>
</div>
<div class="movecontainer" style="background:#e1e1e1">
Container 2 :
</div>
<input type="button" value="copy to container 2" id="movechosen" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.6.1/chosen.jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.6.1/chosen.css" />
The copying to another container is successful but unfortunately, the chosen elements do not load when focused on.