简体   繁体   中英

How to put HTML Tag in JavaScript

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'
                ]
            });
});

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.

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM