I have a problem when I try to use the jQuery add function, it adds an element to a div, but it loses 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 js:
$('#btnAdd').click(function(){ $('#mainDiv').append(' <input type="checkbox" data-toggle="toggle"/>'); })
My input style is bootstrap-toggle.
Can you help me? Thanks
javascript jquery html css twitter-bootstrap
tmac12
source share