Reputation: 2046
I have used the bootstrap 3.2.
I want to add the checkbox using jQuery.
I have used the following html to append in div with id "all_deal_type".
Here is the div html
<div class="col-md-10 pull-right" style="padding-left:0px;" id="all_deal_type"</div>
Here is the html template which I used to append in the div.
var template = '<div class="col-md-3">'
+'<div class="form-group">'
+'<div class="checkbox-list">'
+'<label>'
+'<input type="checkbox" value="'+i+'"> '+v+'</label>'
+'<label>'
+'</div>'
+'</div>'
+'</div>';
$("#all_deal_type").append(template);
when I append the checkbox html it does not show as bootstrap do with the checkbox.
Can you please guide me where I am wrong?
Upvotes: 1
Views: 235
Reputation: 828
change html formatting
<div class="form-group checkbox-list col-md-9" style="padding-left:0px;" id="all_deal_type">
</div>
change jquery to
var template = '<div class="checkbox col-md-3">'
+'<label>'
+'<input type="checkbox" value="'+i+'">'
+v+'</label>'
+'</div>';
$("#all_deal_type").append(template);`
Upvotes: 1