How can I remove default button class of a dataTables button?

Viewed 22660

I am using Data table with Button. I want to show Success button rather default. I tried this Code

buttons: [
{
extend: "excel",
className: "btn-sm btn-success",
titleAttr: 'Export in Excel',
text: 'Excel'
}]

This code is working but this is adding btn-success class, But I want to remove the btn-default class first and then add the success class.

Current Classes: "btn btn-default buttons-excel buttons-html5 btn-sm btn-success"

What I want : "btn buttons-excel buttons-html5 btn-sm btn-success"

6 Answers

Changing the default class for all buttons in Datatable (Updated fiddle)

$.fn.dataTable.Buttons.defaults.dom.button.className = 'btn'; //'btn btn-primary'

Try this

$('.dt-button').removeClass("dt-button");  
Related