Test

Javascript code posted
created at 12 Sep 02:36, updated at 12 Sep 02:38

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<form action="" method="POST" id="payment-form">
    <div class="form-row">
        <label>Card Number</label>
        <input type="text" maxlength="20" autocomplete="off" class="card-number required" />
    </div>

    <div class="form-row">
        <label>CVC</label>
        <input type="text" maxlength="4" autocomplete="off" class="card-cvc required" />
    </div>

    <div class="form-row">
        <label>Expiration</label>
        <div class="expiry-wrapper">
            <select class="card-expiry-month required">
            </select>
            <script type="text/javascript">
                //populate the expiration month dropdown
                var select = $(".card-expiry-month");
                for (var i = 1; i <= 12; i++) {
                    select.append($("<option value='"+i+"'>"+i+"</option>"))
                }
            </script>
            <span> / </span>
            <select class="card-expiry-year required"></select>
            <script type="text/javascript">
                var select = $(".card-expiry-year"),
                    year = new Date().getFullYear();
                for (var i = 1; i < 10; i++) {
                    select.append($("<option value='"+(i + year)+"' "+(i === 0 ? "selected" : "")+">"+(i + year)+"</option>"))
                }
            </script>
        </div>
    </div>
    <button type="submit" class="submit-button">Submit Payment</button>
</form>
1.43 KB in 4 ms with coderay