JQuery Payment

Developer
Size
4,158 Kb
Views
4,048

How do I make an jquery payment?

Auto formatting input fields for a better payment UX. What is a jquery payment? How do you make a jquery payment? This script and codes were developed by Andres on 14 January 2023, Saturday.

JQuery Payment Previews

JQuery Payment - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jQuery Payment</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600");
@import url("https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css");
* { margin: 0; padding: 0; box-sizing: border-box;
}
html, body { height: 100%;
}
body { font: 16px/1 'Open Sans', sans-serif; color: #555; background: #ddd;
}
.title { padding: 35px 0 40px; text-align: center;
}
.title span { display: block; margin: 0 0 15px; font-size: 30px;
}
.payment { width: 500px; margin: 0 auto; padding: 35px 0; border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;
}
[placeholder]::-webkit-input-placeholder { color: rgba(0, 0, 0, 0.3);
}
[placeholder]:hover::-webkit-input-placeholder { color: rgba(0, 0, 0, 0.15);
}
[placeholder]:focus::-webkit-input-placeholder { color: transparent;
}
[placeholder]::-moz-placeholder { color: rgba(0, 0, 0, 0.3);
}
[placeholder]:hover::-moz-placeholder { color: rgba(0, 0, 0, 0.15);
}
[placeholder]:focus::-moz-placeholder { color: transparent;
}
[placeholder]:-ms-input-placeholder { color: rgba(0, 0, 0, 0.3);
}
[placeholder]:hover:-ms-input-placeholder { color: rgba(0, 0, 0, 0.15);
}
[placeholder]:focus:-ms-input-placeholder { color: transparent;
}
button::-moz-focus-inner,
input::-moz-focus-inner { border: 0; padding: 0;
}
label, input, button { display: block; width: 200px; margin: 0 auto 10px;
}
label { font-size: 13px; font-weight: 600; color: #777;
}
input { padding: 10px 15px; font-size: 14px; color: inherit; border: 1px solid #aaa; outline: 0;
}
button { padding: 10px 15px; font-size: 14px; font-weight: 600; color: #fff; border: 0; border-bottom: 3px solid #37b; background: #48c;
}
input.invalid { border: 1px solid red;
}
.validation.failed:after { color: red; content: 'Validation failed';
}
.validation.passed:after { color: green; content: 'Validation passed';
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js'></script>
<script src='https://stripe.github.io/jquery.payment/lib/jquery.payment.js'></script>
<div class="title"> <span>jQuery Payment</span> auto formatting input fields for a better payment UX
</div>
<div class="payment"> <form novalidate autocomplete="on"> <label>Card number:</label> <input type="text" class="cc-number" pattern="\d*" x-autocompletetype="cc-number" placeholder="•••• •••• •••• ••••" required /> <label>Expires:</label> <input type="text" class="cc-exp" pattern="\d*" x-autocompletetype="cc-exp" placeholder="MM / YYYY" required maxlength="9" /> <label>CVC:</label> <input type="text" class="cc-cvc" pattern="\d*" x-autocompletetype="cc-csc" placeholder="123" required maxlength="4" autocomplete="off" /> <label class="validation"></label> <button type="submit">Submit</button> </form>
</div> <script src="js/index.js"></script>
</body>
</html>

JQuery Payment - Script Codes CSS Codes

@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600");
@import url("https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css");
* { margin: 0; padding: 0; box-sizing: border-box;
}
html, body { height: 100%;
}
body { font: 16px/1 'Open Sans', sans-serif; color: #555; background: #ddd;
}
.title { padding: 35px 0 40px; text-align: center;
}
.title span { display: block; margin: 0 0 15px; font-size: 30px;
}
.payment { width: 500px; margin: 0 auto; padding: 35px 0; border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;
}
[placeholder]::-webkit-input-placeholder { color: rgba(0, 0, 0, 0.3);
}
[placeholder]:hover::-webkit-input-placeholder { color: rgba(0, 0, 0, 0.15);
}
[placeholder]:focus::-webkit-input-placeholder { color: transparent;
}
[placeholder]::-moz-placeholder { color: rgba(0, 0, 0, 0.3);
}
[placeholder]:hover::-moz-placeholder { color: rgba(0, 0, 0, 0.15);
}
[placeholder]:focus::-moz-placeholder { color: transparent;
}
[placeholder]:-ms-input-placeholder { color: rgba(0, 0, 0, 0.3);
}
[placeholder]:hover:-ms-input-placeholder { color: rgba(0, 0, 0, 0.15);
}
[placeholder]:focus:-ms-input-placeholder { color: transparent;
}
button::-moz-focus-inner,
input::-moz-focus-inner { border: 0; padding: 0;
}
label, input, button { display: block; width: 200px; margin: 0 auto 10px;
}
label { font-size: 13px; font-weight: 600; color: #777;
}
input { padding: 10px 15px; font-size: 14px; color: inherit; border: 1px solid #aaa; outline: 0;
}
button { padding: 10px 15px; font-size: 14px; font-weight: 600; color: #fff; border: 0; border-bottom: 3px solid #37b; background: #48c;
}
input.invalid { border: 1px solid red;
}
.validation.failed:after { color: red; content: 'Validation failed';
}
.validation.passed:after { color: green; content: 'Validation passed';
}

JQuery Payment - Script Codes JS Codes

jQuery(function($){ $('.cc-number').payment('formatCardNumber'); $('.cc-exp').payment('formatCardExpiry'); $('.cc-cvc').payment('formatCardCVC'); $('form').submit(function(e){ e.preventDefault(); $('input').removeClass('invalid'); $('.validation').removeClass('passed failed'); var cardType = $.payment.cardType($('.cc-number').val()); $('.cc-number').toggleClass('invalid', !$.payment.validateCardNumber($('.cc-number').val())); $('.cc-exp').toggleClass('invalid', !$.payment.validateCardExpiry($('.cc-exp').payment('cardExpiryVal'))); $('.cc-cvc').toggleClass('invalid', !$.payment.validateCardCVC($('.cc-cvc').val(), cardType)); if ( $('input.invalid').length ) { $('.validation').addClass('failed'); } else { $('.validation').addClass('passed'); } });
});
JQuery Payment - Script Codes
JQuery Payment - Script Codes
Home Page Home
Developer Andres
Username Angelfire
Uploaded January 14, 2023
Rating 3
Size 4,158 Kb
Views 4,048
Do you need developer help for JQuery Payment?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Andres (Angelfire) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!