2013-04-03 226 views
-1

我试图给我的搜索标签回地面颜色... 但问题是我的搜索标签来自数据表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' : ''); 
     }); 
    }); 
}); 
+1

大声笑,男人,我很佩服你。你至少有两个问题,每天使用此代码:D – 2013-04-03 22:41:44

回答

1

嗯,我的代码相同的地方,你给了它一个边界:

.dataTables_filter label 
+0

哦,你可能是这个意思:input [type = text] {background-color:red;} – 2013-04-03 22:50:37

0

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

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