Anyone can help how to put HTML tag in Javascript code below?
My plan is to have a space after word "entries".
Below are the Javascript code.
$('document').ready(function(){
$('.data-table-export').DataTable({
scrollCollapse: true,
autoWidth: false,
responsive: true,
columnDefs: [{
targets: "datatable-nosort",
orderable: false,
}],
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"language": {
"info": "_START_-_END_ of _TOTAL_ entries",
searchPlaceholder: "Search"
},
dom: 'Bfltip',
buttons: [
'copy', 'csv', 'pdf', 'print'
]
});
});
asked May 15, 2019 at 0:42
mastersuse
9883 gold badges17 silver badges46 bronze badges
2 Answers 2
You might be better off using CSS:
.data-table-export select {
margin-right: 10px;
}
This won't achieve exactly what you're after, as I do not know the HTML structure returned by .DataTable, but you could certainly adapt it to your needs!
Since the question has a js tag, you could do $('.data-table-export X').css('marginLeft', '10px') where X is the selector for the first button.
Sign up to request clarification or add additional context in comments.
3 Comments
cssyphus
I think you might mean
.data-table-export {margin-left:10px} ... ?Frish
@gibberish if it were something like
button:first-of-type, then sure! And yes, first stab was very invalid CSS, oops!gavgrif
I agree - spacing should be done with css not with adding non-breaking spaces to the html
Change from
"info": "_START_-_END_ of _TOTAL_ entries"
to
"info": "_START_-_END_ of _TOTAL_ entries "
Or update info section CSS
.dataTables_info{
padding-right:5px;
}
answered May 15, 2019 at 0:52
Hien Nguyen
19k7 gold badges57 silver badges70 bronze badges
3 Comments
mastersuse
Just apply and nothing change.
Hien Nguyen
did you try "info": "START-END of TOTAL entries " ?
mastersuse
already answered above for your both solutions but nothing changes happen :-)
default
margin-leftto the button-group next to your string. What's the class of the button-group with "copy, csv, pdf, print"?