javascript - Issue with Stripe elements.create focus's class
问题描述
Here is what I tried :
-1. HTML
<form role="form">
<div class="text-danger" id="errors"></div>
<div class="form-group">
<label for="cardholder-name">Nom complet</label>
<input type="text" id="cardholder-name" name="cardholder-name" placeholder="Jason Doe" required class="form-control">
</div>
<div class="form-group">
<label for="card-element">Informations de la carte</label>
<div id="card-element"></div>
</div>
-2 JS
let card = elements.create('card', {
classes: {
base: "form-control",
focus: "#a9c9eb",
},
});
And here's what I get (issue = red arrow, what I want it to be like = green arrow):
Thank for your time.
---------------- Correction i used ----------------
I used this :
<style>
.StripeElement--focus {
border-color: #80BDFF;
background-color: #fff;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.StripeElement--invalid {
border-color: #dc3545;
background-color: #fff;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}
#card-element.form-control {
display:block;
}
</style>
And just corrected this :
let card = elements.create('card');
解决方案
The Style object for Stripe Elements doesn't provide a way to add a border rule for the inner elements. Instead you should just add your CSS rules to the wrapping div, card-element
.
推荐阅读
- python - 在 matplotlib 中显示张量图像
- revit-api - Revit API python错误:异常:idx只能是0、1、2
- ios - Swift iOS GoogleAPIClientForREST – Shell 脚本调用错误 GTMSessionFetcher.framework:没有这样的文件或目录
- google-sheets - 如何在 Google 表格中缩短此语法?
- php - PHP:上传图片时看不到 $_FILES 的内容
- javascript - 从 json 读取嵌套值
- google-apis-explorer - 如何使用谷歌自定义搜索引擎获取图片的 URL
- google-cloud-platform - 使用 Cloud Build 更新时删除计算实例上的旧 Docker 映像
- python - 将网络抓取的结果分组到各个部分
- html - CSS 和 HTML 中未设置背景颜色