Pankaj Badukale
Pankaj Badukale

Reputation: 2046

Bootstrap 3.2: When added checkbox with jQuery, it not going to visible with proper css

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

Answers (2)

shaN
shaN

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

Cerlin
Cerlin

Reputation: 6722

try adding checkbox class to form-group div or checkbox-list div

Upvotes: 0

Related Questions