html - 在引导程序上使用 btn-outline 输入文件
问题描述
我有一个引导表单,其中有一个输入文件,但我希望它具有 btn-outline-info 的设计,所以我这样做:
<div class="btn btn-outline-info btn-lg">
<input id="signedAgreementFile" type="file" class="form-control-file">
</div>
所以我有一个“选择文件”按钮,旁边有一个字符串:蓝色的“无文件选择”,它们都在一个蓝色框中:
直到这里一切顺利。但是当我上传文件时,文件名替换“无文件选择”但始终保持白色:
我不知道为什么以及如何纠正它。我什至无法访问 HTML 中的此文本。
解决方案
尝试这个?
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<div class="btn btn-outline-info btn-lg">
<input id="signedAgreementFile" type="file" class="form-control-file" onchange="this.style.color='#17a2be'">
</div>
推荐阅读
- linux - 如何使用 SH 从文本填充创建列表?
- flutter - 需要用 Provider 更新 TextController
- html - 如何在不同大小的列中显示文章的不同部分?
- react-native - React Native Linking openURL:使用特殊字符,如 # 和 *
- r - 将一列中的值添加到另一列中的值
- php - 突然的 OpenSSL 错误消息:错误:14090086 使用 file_get_contents
- javascript - 使用 Angular 中的日期对象将 BST 时间传递给 API
- python - FileNotFoundError:[Errno 2] 没有这样的文件或目录:'hadoop'
- ibm-datapower - 如何使用 API 调用在 IBM Datapower 中添加加密证书
- google-bigquery - 基于组和时间戳的唯一值