user3461461
user3461461

Reputation: 326

DataTable Buttons - Custom

In my configuration of a datatable button i have this:

buttons:[{
  extend: 'csvHtml5',
  text: '<span class="blabel"><i class="fa fa-download">  </i></span><span class="btxt">Export table</span>',
  className: 'btn btn-labeled'
},

the result is this button:

<a class="btn btn-default buttons-csv buttons-html5 btn-labeled" tabindex="0" aria-controls="DataTables_Table_0" href="#">
<span> ---> I wanna remove this
<span class="blabel">
<span class="btxt">Export table to CSV</span>
</span>
</a>

I wanna remove the external span and the buttons-csv buttons-html5 classes... what is the correct way to do this??

Upvotes: 1

Views: 315

Answers (1)

Tran Audi
Tran Audi

Reputation: 607

You try use:

Remove span tag

$('span:not([class])').contents().unwrap();

and remove classs

$('.buttons-csv.buttons-html5').removeClass('buttons-csv buttons-html5');

Upvotes: 2

Related Questions