为标签提供背景颜色

时间:2013-04-03 22:36:26

标签: javascript jquery html css datatables

我正在努力为我的搜索标签提供底色...... 但问题是我的搜索标签来自数据表jquery插件... 所以不知道在哪里改变它...... 提供我的代码

http://jsfiddle.net/bz2C4/23/

.dataTables_filter label {
    border: 1px solid red;
}

$(document).ready(function () {
    $('#inventoryTable').dataTable({
        "bFilter": true,
            "bLengthChange": false,
        //"bJQueryUI": true,
        "bSort": false,
            "iDisplayLength": 20,
            "sPaginationType": "full_numbers"
    });
    $('.dataTables_length').remove();
    $('.dataTables_info').remove();
    $('.dataTables_filter').css("text-align", "center");

    $(function () {
        var search = $('.dataTables_filter').detach();
        $('.page-title').before(search);
        search.css('margin-left', '0');

        var div = $('.dataTables_filter');
        var start = $(div).offset().top;

        $.event.add(window, "scroll", function () {
            var p = $(window).scrollTop();
            $(div).css('position', ((p) > start) ? 'fixed' : 'static');
            $(div).css('top', ((p) > start) ? '0px' : '');
        });
    });
});

2 个答案:

答案 0 :(得分:1)

嗯,你给它一个边界的那个地方:

.dataTables_filter label

答案 1 :(得分:0)

只需将这些样式添加到样式表中即可定位该特定标签:

.dataTables_filter label {  
background-color:#FFF;
/*Add whatever other style you want*/}