html - 无法设置模态内部元素的tabindex

标签 html css laravel-5 tabindex

我想在我的模式中设置选择选项的tabindex和加号(fa-plus)。我试过 tabindex="1"。问题是选择接收到焦点,但我无法为选项值键入任何内容。此外,加号没有获得任何焦点。

以下是我的代码:

 <div class="modal fade" id="matnr_name_modal" tabindex="-1" role="dialog" >
    <div class="modal-dialog modal-md" role="document">
        <div class="">
            <div class="modal-content">
                <div class="modal-header" >
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <!--<h4 class="modal-title" >Material Name</h4>-->
                     <div class=" form-group required col-md-12 pull-right" >
                        <div class="col-md-2 nopadding">{!!Form::label('type', 'Category');!!}</div>

                        <div class="col-md-6">
                            <select class="form-control nopadding select2 type " id="type" name="type">
                                <option value="">Select Type</option>

                            </select>
                        </div>
                        <div class="col-md-1 nopadding">
                            <a class="" style="color: green;" target="_blank" href="<?php echo url('add_category');?>"><i class="fa fa-plus fa-2x" aria-hidden="true"></i></a>
                        </div>
                    </div>
                </div>

                <div class="modal-body"  style="height: 300px;overflow-y: scroll;">


                </div>
                <div class="modal-footer">
                    <p class="pull-left">Code:-<strong><span class="ccode"></span></strong></p>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button type="button" class="btn btn-primary create_name">Create</button>
                </div>

            </div>
        </div>
    </div>
</div>

最佳答案

如果能在 codepen 中看到这一切,那就太好了。 但从外观上看,我认为您在选择框中使用 select 2 插件来实现预输入功能。 由于该插件隐藏了选择框并将其替换为自定义用户界面,因此您需要编程访问才能触发它以在焦点上打开。

关于html - 无法设置模态内部元素的tabindex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49165916/

相关文章:

javascript - 在angularjs切换操作中单击按钮时选择和取消选择div

javascript - Angular 错误 : [$rootScope:inprog] $apply already in progress on document. click()

html - 水平方向的瓷砖是否可以在 CSS 中拉伸(stretch)其父级的宽度?

HTML CSS 自动调整高度

css - XML 表需要 CSS 编码

javascript - 使用 npm timepicker Laravel 5.8 的正确方法

html - 每行独立的文本 block

php - 使用 PHP/Laravel5 将数据从 Postgres 迁移到 MySQL

php - Laravel ManyToMany 根据条件加入

jquery - 选择第一,第二。 . . div 在 jquery while 循环中