Datatables 引导数据表:搜索筛选器,清除图标问题

Datatables 引导数据表:搜索筛选器,清除图标问题,datatables,Datatables,datatables.min.css datatables.min.js 2.1.4 jquery,3.3.5引导,1.10.8数据表 清除图标不会出现在chrome、firefox的搜索过滤器输入上,但会出现在IE10及更高版本中。可以在引导示例()中轻松复制 当我添加清除图标的实现时,默认图标也会出现在IE中 是否有一个简单的解决方法来关闭某些浏览器的额外清晰图标?这是html5的问题: /* Disable browser close icon for IE */ input[type="

datatables.min.css datatables.min.js 2.1.4 jquery,3.3.5引导,1.10.8数据表

清除图标不会出现在chrome、firefox的搜索过滤器输入上,但会出现在IE10及更高版本中。可以在引导示例()中轻松复制

当我添加清除图标的实现时,默认图标也会出现在IE中

是否有一个简单的解决方法来关闭某些浏览器的额外清晰图标?

这是html5的问题:

/* Disable browser close icon for IE */
input[type="search"]::-ms-clear {  display: none; width : 0; height: 0; }
input[type="search"]::-ms-reveal {  display: none; width : 0; height: 0; }
/* Disable browser close icon for Chrome */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration { display: none; }

这个解决方案对我很有效:

<script>
$(document).ready(function() {

$('.dataTables_filter input').addClass('searchinput');
$('.dataTables_filter input').attr('placeholder', 'Buscar');

$(".searchinput").keyup(function () {
        $(this).next().toggle(Boolean($(this).val()));
    });
    $(".searchclear").toggle(Boolean($(".searchinput").val()));
    $(".searchclear").click(function () {
        $(this).prev().val('').focus();
        $(this).hide();
        var table = $('#dt_basic').DataTable();
        //clear datatable
        table
            .search('')
            .columns().search('')
            .draw();
    });

});
</script>
jquery.dataTables.min.js中,需要在输入后添加图标remove circle

原始代码

'<input type="search" '+c.sFilterInput+'"/>'
“”

引导的样式从引导数据表的搜索输入中删除清除图标。这是引导默认行为的一部分

将此添加到CSS中:

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: searchfield-cancel-button;
}

它将覆盖引导隐藏的清除按钮。

此解决方案实际上适用于我的特定情况。谢谢你发布它。。。
<input type="search" '+c.sFilterInput+'"/><span id="searchclear" class="searchclear glyphicon glyphicon-remove-circle"></span>'
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: searchfield-cancel-button;
}