html – Bootstrap材料浮动标签在自动填充上不起作用

前端之家收集整理的这篇文章主要介绍了html – Bootstrap材料浮动标签在自动填充上不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的页面上使用了 bootstrap material kit,但是我的问题是标签没有在chrome上自动填充.我已经四处搜索,看到这是一个已知的问题,并尝试使用建议的解决方here.但它仍然不适合我.不知道该怎么解决

这就是我调用样式表的方式:

  1. <link href="/css/material-kit/css/bootstrap.min.css" rel="stylesheet" />
  2. <link href="/css/material-kit/css/material-kit.css" rel="stylesheet"/>
  3. <link href="/css/landing-page.css" rel="stylesheet"/>

HTML:

  1. <div class="form-group label-floating">
  2. <label class="control-label">Password</label>
  3. <input type="password" name="password" class="form-control" required/>
  4. @if ($errors->has('password'))
  5. <span class="help-block">
  6. <strong>{{ $errors->first('password') }}</strong>
  7. </span>
  8. @endif
  9. </div>

和脚本:

  1. <!-- Core JS Files -->
  2. <script src="/js/landing-page/jquery.min.js" type="text/javascript"></script>
  3. <script src="/js/landing-page/bootstrap.min.js" type="text/javascript"></script>
  4. <script src="/js/landing-page/material.min.js"></script>
  5. <script>
  6. $(document).ready(function() {
  7. $.material.options.autofill = true;
  8. $.material.init();
  9. });
  10. </script>

解决方法

这最终对我有用:
  1. $(window).load($.debounce(200,function(){
  2. $('input:-webkit-autofill').each(function(){
  3. if ($(this).val().length !== "") {
  4. $(this).siblings('label,i').addClass('active');
  5. }
  6. });
  7. }));

猜你在找的HTML相关文章