如果使用$(document).ready(function() {
var stripe = Stripe("pk_test_6pRNASCoBOKtIshFeQd4XMUh");
var elements = stripe.elements();
var isValidCard =false;
var style = {
base: {
iconColor: "#666EE8",
color: "#31325F",
lineHeight: "40px",
fontWeight: 600,
fontSize: "16px",
"::placeholder": {
color: "#CFD7E0",
fontWeight: 400
}
}
};
var cardNumberElement = elements.create("cardNumber", {
style: style
});
cardNumberElement.mount("#cc-number");
var cardExpiryElement = elements.create("cardExpiry", {
style: style
});
cardExpiryElement.mount("#cc-exp");
var cardCvcElement = elements.create("cardCvc", {
style: style
});
cardCvcElement.mount("#cc-cvc");
function setOutcome(result) {
var successElement = document.querySelector(".success");
var errorElement = document.querySelector(".error");
successElement.classList.remove("visible");
errorElement.classList.remove("visible");
if (result.token) {
// In this example, we're simply displaying the token
successElement.querySelector(".token").textContent = result.token.id;
successElement.classList.add("visible");
isValidCard = true;
// In a real integration, you'd submit the form with the token to your backend server
//var form = document.querySelector('form');
//form.querySelector('input[name="token"]').setAttribute('value', result.token.id);
//form.submit();
} else if (result.error) {
errorElement.textContent = result.error.message;
errorElement.classList.add("visible");
isValidCard=false;
}
}
document.querySelector(".payment").addEventListener("submit", function(e) {
e.preventDefault();
var options = {};
stripe.createToken(cardNumberElement, options).then(setOutcome);
});
$(".payment").on("click", ".btn--save", function() {
// var valid = $(".card__board").paymentForm("valid");
if(isValidCard){
}
});
});
,则会在右侧显示您看到的内容。
我想在左边做这个,有可能吗?
这是一个代码
navigationBarItems
这是一张图片