Reputation: 61
I am currently trying to create a payment form. I am trying to create a payment form like the ones on the online shopping websites. I have created drop down lists for type of credit card and months but I'm not to sure about the year drop down list. Would I use the same code as I did for months and type of credit cards? Do I just put all the years manually or is the another way to do it?
Upvotes: 0
Views: 128
Reputation: 457
Manually is the safest choice but you can do it in JS or backend server..
Presume that the year starts on the current year.. then and you are using jQuery
var years = $('<select>');
var currnet_year = new Date().getFullYear();
for(var i =1; i < 51; i++){
var n_y =(currnet_year +i);
years.append( $('<option>',{ text: (n_y ), value:n_y }) );
}
append the years everyware you want.
Upvotes: 1
Reputation: 27082
HTML nor JS don´t know <credit_card_year>
tag.
So use <select>
tag with next few (three, four?) years.
Upvotes: 1