Tuesday, 3 September 2013

jquery append doesnt include bootstrap style after adding

jquery append doesnt include bootstrap style after adding

I have a jquery script
$('.add-item').on('click',function(){
var URL = '{% url "main:adding_from_all_products" %}';
var $this = $(this);
var product_add_name = $this.data('item-name');
$.post(URL,{'product_add_name':product_add_name},function(response){
$(".test").append('<p class="product-item">'+
'<span class="product-width-fix">' +
response +
'<a href="#" data-product-id=' +
product_add_name +
'class="btn btn-mini btn-success
remove-product">Remove</a></span></p>');
})
return true;
});
The element I add is a button styled with bootstrap. But after the append
is done
<a href="#" data-product-id=' + product_add_name +
'class="btn btn-mini btn-success
remove-product">Remove</a></span></p>
the button does not apper, it's just a link withouth any style. what
should i do ?

No comments:

Post a Comment