简体   繁体   English

导航栏下方的搜索文本框

[英]search text box below the nav bar

I am using jquery data tables... I wanted to move the search text box of the data tables to center of the page and below navigation bar.... the problem is the search text box comes with the data tables plug in so don't know how to move it.... providing my code below... 我正在使用jquery数据表...我想将数据表的搜索文本框移动到页面中心和导航栏下方。...问题是数据表插件随附了搜索文本框,所以不要不知道如何移动...。在下面提供我的代码...

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

<div class="dataTables_filter" id="vendortable_filter" style="margin-left: 80%;"><label>Search: <input type="text" aria-controls="vendortable"></label></div>

<script type="text/javascript" >
$(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("float", "right");
});
</script>

You can move it using jquery, in not a suggested method but if you can't change the source code is the only way. 您可以使用jquery来移动它,而不是建议的方法,但是如果您不能更改源代码,则是唯一的方法。 Look at something like this 看这样的东西

$(function() {
  var search = $('.dataTables_filter').detach();
  $('.page-title').before(search);
  var left = ($('.page-title').width() / 2) - (search.width() / 2);
  search.css('margin-left',left+'px');
  search.css('float','');

}); });

Look working here jsfiddle 看起来在这里工作jsfiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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