I have a problem when I try to use append function of jQuery, it add element to a div but it lose style. This is an example here
This is my html:
<form>
<div class="checkbox">
<label>
<input type="checkbox" data-toggle="toggle" checked="checked" />
Toggle One
</label>
</div>
<div id="mainDiv">
</div>
<div>
<button type="button" class="btn btn-default" id="btnAdd">
Add
</button>
</div>
and this is the js:
$('#btnAdd').click(function(){
$('#mainDiv').append(' <input type="checkbox" data-toggle="toggle"/>');
})
The style of my input is bootstrap-toggle.
Can you help me? Thanks