{"id":2973,"date":"2017-11-30T18:50:42","date_gmt":"2017-11-30T18:50:42","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=2973"},"modified":"2017-11-30T18:58:26","modified_gmt":"2017-11-30T18:58:26","slug":"credit-card-number-validation-jquery","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/","title":{"rendered":"Credit Card Validation using jQuery"},"content":{"rendered":"<p>It always a good idea to validate credit card number on the client side before submitting the card details on the server side. If you <a href=\"https:\/\/www.codexworld.com\/stripe-payment-gateway-integration-php\/\">accept credit card payment<\/a> in your web application, credit card validation is the must-have functionality on the payment form. It helps to validate credit card number and other details before submitting the payment.<\/p>\n<p>We can easily implement the credit card validation on the payment form using jQuery. In this tutorial, we will show you how to integrate credit card validation in payment form using jQuery. For better usability, we will create a simple <b>jQuery plugin for credit card number validation<\/b>. This jQuery plugin will detect and validate credit card numbers, and instantly tell you whether the card is valid or not.<\/p>\n<h2>Credit Card Validator jQuery<\/h2>\n<p>The Credit Card Validator jQuery plugin detect the card type by number and help to validate the credit card. It returns the following properties as an object.<\/p>\n<ul class=\"bullet_disk_list\">\n<li><code>card_type<\/code> \u2014 Returns an object with the below properties, or null if card type unknown\n<ul>\n<li><code>name<\/code> \u2014 Returns string of the card type, eg visa<\/li>\n<li><code>pattern<\/code> \u2014 Returns card number pattern, eg \/^4\/<\/li>\n<li><code>valid_length<\/code> \u2014 Returns valid lengths for the card type, eg [13, 16]<\/li>\n<\/ul>\n<\/li>\n<li><code>length_valid<\/code> \u2014 Returns true if the number length is valid, false otherwise<\/li>\n<li><code>luhn_valid<\/code> \u2014 Returns true if the Luhn checksum is correct, false otherwise<\/li>\n<li><code>valid<\/code> \u2014 Returns true if the number is valid, false otherwise<\/li>\n<\/ul>\n<p><b>Usage:<\/b><br \/>\nUse <code>.validateCreditCard()<\/code> method to add validation functionality to credit card number input field.<\/p>\n<pre><span style=\"color:#691c97\">$<\/span>('<span style=\"color:#bf4f24\">#card_number<\/span>').validateCreditCard(<span style=\"color:#a71d5d;font-style:italic\">function<\/span>(result){ \r\n\r\n});\r\n<\/pre>\n<p><span class=\"note\">Note that:<\/span> The <code>creditCardValidator.js<\/code> file is included in the source code, you don&#8217;t need to download it separately.<\/p>\n<h2>jQuery &#038; Credit Card Validator Library<\/h2>\n<p>The example code uses jQuery, include the jQuery library first.<\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">script<\/span> <span style=\"color:#bf4f24\">src<\/span>=<span style=\"color:#0b6125\">\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.2.1\/jquery.min.js\"<\/span>>&lt;\/<span style=\"color:#bf4f24\">script<\/span>>\r\n<\/pre>\n<p>To validate card number include the Credit Card Validator jQuery plugin.<\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">script<\/span> <span style=\"color:#bf4f24\">src<\/span>=<span style=\"color:#0b6125\">\"creditCardValidator.js\"<\/span>>&lt;\/<span style=\"color:#bf4f24\">script<\/span>>\r\n<\/pre>\n<h2>JavaScript Code<\/h2>\n<p>The <code>cardFormValidate()<\/code> function helps to validate credit card details. At first card number is validated using Credit Card Validator plugin. After that, credit card expiry month, year, cvv, and name field are validated using jQuery.<\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">script<\/span>>\r\n<span style=\"color:#a71d5d;font-style:italic\">function<\/span> <span style=\"color:#bf4f24\">cardFormValidate<\/span>(){\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> cardValid <span style=\"color:#794938\">=<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n\r\n    <span style=\"color:#5a525f;font-style:italic\">\/\/card number validation<\/span>\r\n    <span style=\"color:#691c97\">$<\/span>('<span style=\"color:#bf4f24\">#card_number<\/span>').validateCreditCard(<span style=\"color:#a71d5d;font-style:italic\">function<\/span>(result){\r\n        <span style=\"color:#794938\">if<\/span>(result.valid){\r\n            <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n            cardValid <span style=\"color:#794938\">=<\/span> <span style=\"color:#811f24;font-weight:700\">1<\/span>;\r\n        }<span style=\"color:#794938\">else<\/span>{\r\n            <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.addClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n            cardValid <span style=\"color:#794938\">=<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n        }\r\n    });\r\n      \r\n    <span style=\"color:#5a525f;font-style:italic\">\/\/card details validation<\/span>\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> cardName <span style=\"color:#794938\">=<\/span> <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#name_on_card<\/span>\")<span style=\"color:#693a17\">.val<\/span>();\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> expMonth <span style=\"color:#794938\">=<\/span> <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_month<\/span>\")<span style=\"color:#693a17\">.val<\/span>();\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> expYear <span style=\"color:#794938\">=<\/span> <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_year<\/span>\")<span style=\"color:#693a17\">.val<\/span>();\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> cvv <span style=\"color:#794938\">=<\/span> <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#cvv<\/span>\")<span style=\"color:#693a17\">.val<\/span>();\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> regName <span style=\"color:#794938\">=<\/span><span style=\"color:#cf5628\"> \/^[a-z ,.'-]+$\/i<\/span>;\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> regMonth <span style=\"color:#794938\">=<\/span><span style=\"color:#cf5628\"> \/^01|02|03|04|05|06|07|08|09|10|11|12$\/<\/span>;\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> regYear <span style=\"color:#794938\">=<\/span><span style=\"color:#cf5628\"> \/^2017|2018|2019|2020|2021|2022|2023|2024|2025|2026|2027|2028|2029|2030|2031$\/<\/span>;\r\n    <span style=\"color:#a71d5d;font-style:italic\">var<\/span> regCVV <span style=\"color:#794938\">=<\/span><span style=\"color:#cf5628\"> \/^[0-9]{3,3}$\/<\/span>;\r\n    <span style=\"color:#794938\">if<\/span> (cardValid <span style=\"color:#794938\">==<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>) {\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.addClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.focus<\/span>();\r\n        <span style=\"color:#794938\">return<\/span> <span style=\"color:#811f24;font-weight:700\">false<\/span>;\r\n    }<span style=\"color:#794938\">else<\/span> <span style=\"color:#794938\">if<\/span> (<span style=\"color:#794938\">!<\/span>regMonth.<span style=\"color:#693a17\">test<\/span>(expMonth)) {\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_month<\/span>\")<span style=\"color:#693a17\">.addClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_month<\/span>\")<span style=\"color:#693a17\">.focus<\/span>();\r\n        <span style=\"color:#794938\">return<\/span> <span style=\"color:#811f24;font-weight:700\">false<\/span>;\r\n    }<span style=\"color:#794938\">else<\/span> <span style=\"color:#794938\">if<\/span> (<span style=\"color:#794938\">!<\/span>regYear.<span style=\"color:#693a17\">test<\/span>(expYear)) {\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_month<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_year<\/span>\")<span style=\"color:#693a17\">.addClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_year<\/span>\")<span style=\"color:#693a17\">.focus<\/span>();\r\n        <span style=\"color:#794938\">return<\/span> <span style=\"color:#811f24;font-weight:700\">false<\/span>;\r\n    }<span style=\"color:#794938\">else<\/span> <span style=\"color:#794938\">if<\/span> (<span style=\"color:#794938\">!<\/span>regCVV.<span style=\"color:#693a17\">test<\/span>(cvv)) {\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_month<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_year<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#cvv<\/span>\")<span style=\"color:#693a17\">.addClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#cvv<\/span>\")<span style=\"color:#693a17\">.focus<\/span>();\r\n        <span style=\"color:#794938\">return<\/span> <span style=\"color:#811f24;font-weight:700\">false<\/span>;\r\n    }<span style=\"color:#794938\">else<\/span> <span style=\"color:#794938\">if<\/span> (<span style=\"color:#794938\">!<\/span>regName.<span style=\"color:#693a17\">test<\/span>(cardName)) {\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_month<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_year<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#cvv<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#name_on_card<\/span>\")<span style=\"color:#693a17\">.addClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#name_on_card<\/span>\")<span style=\"color:#693a17\">.focus<\/span>();\r\n        <span style=\"color:#794938\">return<\/span> <span style=\"color:#811f24;font-weight:700\">false<\/span>;\r\n    }<span style=\"color:#794938\">else<\/span>{\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#card_number<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_month<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#expiry_year<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#cvv<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#691c97\">$<\/span>(\"<span style=\"color:#bf4f24\">#name_on_card<\/span>\")<span style=\"color:#693a17\">.removeClass<\/span>(<span style=\"color:#0b6125\">'required'<\/span>);\r\n        <span style=\"color:#794938\">return<\/span> <span style=\"color:#811f24;font-weight:700\">true<\/span>;\r\n    }\r\n}\r\n<span style=\"color:#691c97\">$<\/span>(<span style=\"color:#691c97\">document<\/span>)<span style=\"color:#693a17\">.ready<\/span>(<span style=\"color:#a71d5d;font-style:italic\">function<\/span>() {\r\n    <span style=\"color:#5a525f;font-style:italic\">\/\/card validation on input fields<\/span>\r\n    <span style=\"color:#691c97\">$<\/span>('<span style=\"color:#bf4f24\">#paymentForm<\/span> <span style=\"color:#bf4f24\">input<\/span>[type=text]').on(<span style=\"color:#0b6125\">'keyup'<\/span>,<span style=\"color:#a71d5d;font-style:italic\">function<\/span>(){\r\n        cardFormValidate();\r\n    });\r\n});\r\n&lt;\/<span style=\"color:#bf4f24\">script<\/span>>\r\n<\/pre>\n<h2>HTML Code<\/h2>\n<p>The following HTML creates a payment form to provide the credit card details.<\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">form<\/span> <span style=\"color:#bf4f24\">method<\/span>=<span style=\"color:#0b6125\">\"post\"<\/span> <span style=\"color:#bf4f24\">id<\/span><span style=\"color:#794938\">=<\/span><span style=\"color:#0b6125\">\"paymentForm\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">label<\/span>>Card number&lt;\/<span style=\"color:#bf4f24\">label<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">placeholder<\/span>=<span style=\"color:#0b6125\">\"1234 5678 9012 3456\"<\/span> <span style=\"color:#bf4f24\">id<\/span><span style=\"color:#794938\">=<\/span><span style=\"color:#0b6125\">\"card_number\"<\/span> >\r\n    &lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">label<\/span>>Expiry month&lt;\/<span style=\"color:#bf4f24\">label<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">placeholder<\/span>=<span style=\"color:#0b6125\">\"MM\"<\/span> <span style=\"color:#bf4f24\">maxlength<\/span>=<span style=\"color:#0b6125\">\"5\"<\/span> <span style=\"color:#bf4f24\">id<\/span><span style=\"color:#794938\">=<\/span><span style=\"color:#0b6125\">\"expiry_month\"<\/span>>\r\n    &lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">label<\/span>>Expiry year&lt;\/<span style=\"color:#bf4f24\">label<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">placeholder<\/span>=<span style=\"color:#0b6125\">\"YYYY\"<\/span> <span style=\"color:#bf4f24\">maxlength<\/span>=<span style=\"color:#0b6125\">\"5\"<\/span> <span style=\"color:#bf4f24\">id<\/span><span style=\"color:#794938\">=<\/span><span style=\"color:#0b6125\">\"expiry_year\"<\/span>>\r\n    &lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">label<\/span>>CVV&lt;\/<span style=\"color:#bf4f24\">label<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">placeholder<\/span>=<span style=\"color:#0b6125\">\"123\"<\/span> <span style=\"color:#bf4f24\">maxlength<\/span>=<span style=\"color:#0b6125\">\"3\"<\/span> <span style=\"color:#bf4f24\">id<\/span><span style=\"color:#794938\">=<\/span><span style=\"color:#0b6125\">\"cvv\"<\/span>>\r\n    &lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">label<\/span>>Name on card&lt;\/<span style=\"color:#bf4f24\">label<\/span>>\r\n        &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">placeholder<\/span>=<span style=\"color:#0b6125\">\"Codex World\"<\/span> <span style=\"color:#bf4f24\">id<\/span><span style=\"color:#794938\">=<\/span><span style=\"color:#0b6125\">\"name_on_card\"<\/span>>\r\n    &lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n&lt;\/<span style=\"color:#bf4f24\">form<\/span>>\r\n<\/pre>\n<h2>Conclusion<\/h2>\n<p>Our Card Validator jQuery plugin makes it simple and powerful to validate credit card number in a user-friendly way. This example code can be used in any types of credit card payment form, like <a href=\"https:\/\/www.codexworld.com\/stripe-payment-gateway-integration-php\/\">Stripe payment gateway integration<\/a>, <a href=\"https:\/\/www.codexworld.com\/paypal-pro-payment-gateway-integration-in-php\/\">PayPal Payments Pro integration<\/a>, etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It always a good idea to validate credit card number on the client side before submitting the card details on the server side. If you accept credit card payment in your web application, credit card <\/p>\n","protected":false},"author":1,"featured_media":2974,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[16,299,257],"class_list":["post-2973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","tag-jquery","tag-plugin","tag-validation","cat-6-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Credit Card Validation using jQuery - CodexWorld<\/title>\n<meta name=\"description\" content=\"Credit card number validation - Validate credit card number and details using jQuery. Code to integrate credit card validation in payment form using jQuery.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Credit Card Validation using jQuery - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Credit card number validation - Validate credit card number and details using jQuery. Code to integrate credit card validation in payment form using jQuery.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-30T18:50:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-30T18:58:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/11\/credit-card-number-validation-jquery-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Credit Card Validation using jQuery\",\"datePublished\":\"2017-11-30T18:50:42+00:00\",\"dateModified\":\"2017-11-30T18:58:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/\"},\"wordCount\":377,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/credit-card-number-validation-jquery-codexworld.png\",\"keywords\":[\"jQuery\",\"Plugin\",\"Validation\"],\"articleSection\":[\"jQuery\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/\",\"name\":\"Credit Card Validation using jQuery - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/credit-card-number-validation-jquery-codexworld.png\",\"datePublished\":\"2017-11-30T18:50:42+00:00\",\"dateModified\":\"2017-11-30T18:58:26+00:00\",\"description\":\"Credit card number validation - Validate credit card number and details using jQuery. Code to integrate credit card validation in payment form using jQuery.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/credit-card-number-validation-jquery-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/credit-card-number-validation-jquery-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"credit-card-number-validation-jquery-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/credit-card-number-validation-jquery\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Credit Card Validation using jQuery\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Credit Card Validation using jQuery - CodexWorld","description":"Credit card number validation - Validate credit card number and details using jQuery. Code to integrate credit card validation in payment form using jQuery.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/","og_locale":"en_US","og_type":"article","og_title":"Credit Card Validation using jQuery - CodexWorld","og_description":"Credit card number validation - Validate credit card number and details using jQuery. Code to integrate credit card validation in payment form using jQuery.","og_url":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2017-11-30T18:50:42+00:00","article_modified_time":"2017-11-30T18:58:26+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/11\/credit-card-number-validation-jquery-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Credit Card Validation using jQuery","datePublished":"2017-11-30T18:50:42+00:00","dateModified":"2017-11-30T18:58:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/"},"wordCount":377,"commentCount":2,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/11\/credit-card-number-validation-jquery-codexworld.png","keywords":["jQuery","Plugin","Validation"],"articleSection":["jQuery"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/","url":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/","name":"Credit Card Validation using jQuery - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/11\/credit-card-number-validation-jquery-codexworld.png","datePublished":"2017-11-30T18:50:42+00:00","dateModified":"2017-11-30T18:58:26+00:00","description":"Credit card number validation - Validate credit card number and details using jQuery. Code to integrate credit card validation in payment form using jQuery.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/11\/credit-card-number-validation-jquery-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/11\/credit-card-number-validation-jquery-codexworld.png","width":1366,"height":768,"caption":"credit-card-number-validation-jquery-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/credit-card-number-validation-jquery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Credit Card Validation using jQuery"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/11\/credit-card-number-validation-jquery-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-LX","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=2973"}],"version-history":[{"count":6,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2973\/revisions"}],"predecessor-version":[{"id":2980,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2973\/revisions\/2980"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/2974"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=2973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=2973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=2973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}