我正在使用 bootstrap material kit在我的页面上,但我有一个标签在 chrome 中自动填充时没有出现的问题。我四处搜索,发现这是一个已知问题,并尝试使用建议的解决方案 here .但它仍然不适合我。不知道如何解决?
我是这样称呼我的样式表的:
<link href="/css/material-kit/css/bootstrap.min.css" rel="stylesheet" />
<link href="/css/material-kit/css/material-kit.css" rel="stylesheet"/>
<link href="/css/landing-page.css" rel="stylesheet"/>
HTML:
<div class="form-group label-floating">
<label class="control-label">Password</label>
<input type="password" name="password" class="form-control" required/>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
和脚本:
<!-- Core JS Files -->
<script src="/js/landing-page/jquery.min.js" type="text/javascript"></script>
<script src="/js/landing-page/bootstrap.min.js" type="text/javascript"></script>
<script src="/js/landing-page/material.min.js"></script>
<script>
$(document).ready(function() {
$.material.options.autofill = true;
$.material.init();
});
</script>
最佳答案
这最终对我有用:
$(window).load($.debounce(200,function(){
$('input:-webkit-autofill').each(function(){
if ($(this).val().length !== "") {
$(this).siblings('label, i').addClass('active');
}
});
}));
关于html - Bootstrap Material float 标签不适用于自动填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42055857/