【问题标题】:How to remove border inside input tag when using tagsinput library in jQuery?在 jQuery 中使用 tagsinput 库时如何删除输入标签内的边框?
【发布时间】:2020-11-26 23:22:04
【问题描述】:

在jQuery中使用tagsinput库时如何去除<input>标签内的边框?

我的问题如下:

我的参考:tagsinput bootstrap

我尝试过但没有解决的问题:

  1. .bootstrap-tagsinput:focus { outline: none !important; }
  2. input:focus, textarea:focus, select:focus { outline: none; }

代码:

<div class="form-group row">
    <div class="col-lg-4 col-sm-4">
        <label class="col-form-label">IP Address Whitelist</label>
    </div>
    <div class="col-lg-8 col-sm-8">
        <input type="text" class="form-control tagsinput" id="addTokenIP" data-role="tagsinput">
        <code>Note: Please press "Enter" for every single IP entered.</code>
    </div>
</div>

$('.tagsinput').tagsinput({
    tagClass: 'badge badge-dark'
});

【问题讨论】:

    标签: html jquery bootstrap-tags-input


    【解决方案1】:

    最后,经过反复尝试,我通过应用这种风格找到了答案。

    .bootstrap-tagsinput > input:focus{
      outline: none !important;
    }
    

    【讨论】:

    • 我很好奇, !important 真的有必要吗?而且,输入标签如何成为 .bootstrap-tagsinput 类的子元素?
    【解决方案2】:

    要覆盖所有主流浏览器,试试这个。

    .bootstrap-tagsinput {
        border: 0;
        border: none;
        outline:0;
        outline:none;
        box-shadow: none;
        border-width: 0px;
        appearance: none;
        -webkit-appearance: none;
    
    }
    input:focus {
        outline:none;
    }    
    

    【讨论】:

    • 如果这不起作用,您可以使用 Chrome 选择输入,右键单击并检查元素吗?它对 CSS 显示了什么?
    • 嗨,我有自己的解决方案。无论如何感谢您的回复。祝你有美好的一天。
    猜你喜欢
    • 2015-12-02
    • 2017-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多