Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在文本框旁边添加一个按钮_Javascript_Jquery_Html_Css_Jquery Ui - Fatal编程技术网

Javascript 在文本框旁边添加一个按钮

Javascript 在文本框旁边添加一个按钮,javascript,jquery,html,css,jquery-ui,Javascript,Jquery,Html,Css,Jquery Ui,当您缩小浏览器窗口时,您将看到不同的iphone布局。。。 如何在搜索文本框旁边添加按钮。。。。 这里的问题是我得到的文本框在js。。。 不知道如何在js中获取按钮 在下面提供我的代码 $(文档).ready(函数(){ $('#inventoryTable')。数据表({ “bFilter”:没错, “bLengthChange”:false, //“bJQueryUI”:没错, “bSort”:错误, “iDisplayLength”:20, “sPaginationType”:“完整编

当您缩小浏览器窗口时,您将看到不同的iphone布局。。。 如何在搜索文本框旁边添加按钮。。。。 这里的问题是我得到的文本框在js。。。 不知道如何在js中获取按钮

在下面提供我的代码


$(文档).ready(函数(){
$('#inventoryTable')。数据表({
“bFilter”:没错,
“bLengthChange”:false,
//“bJQueryUI”:没错,
“bSort”:错误,
“iDisplayLength”:20,
“sPaginationType”:“完整编号”
} );
$('.dataTables_length').remove();
$('.dataTables_info').remove();
$('.dataTables_filter').css(“文本对齐”,“居中”);
$(函数(){
var search=$('.dataTables_filter').detach();
$('.page title')。在(搜索)之前;
css('margin-left','0');
var div=$('.dataTables_filter');
var start=$(div).offset().top;
$.event.add(窗口,“滚动”,函数(){
var p=$(window.scrollTop();
$(div).css('position',((p)>start)?'fixed':'static');
$(div).css('top',((p)>start)?'0px':'';
});
});
});

如果这是您想要看到的:?
…css('position','fixed')
刚把位置固定好。如果您希望根据滚动改变位置, 只需使用另一个示例的事件侦听器。

您想要这个吗?我添加了这行代码
$(“#inventoryTable_filter”).append(“某物”)
<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("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' : '');
                });
    });
});
</script>