Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7726333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:11:14+00:00 2026-06-01T05:11:14+00:00

I used the Input Mask Jquery plugin to mask the credit card field. My

  • 0

I used the Input Mask Jquery plugin to mask the credit card field.
My code in masking is as follows:

$(".cardField").mask("9999 9999 9999 9999");

The problem is i have also used the validator plugin with the following condition:

rules: {
    cardField: {
        required: true,
        digits: true,
        minlength: 16,
        maxlength: 16
    }
 }

Now whenever i type something, it always results to an error because of the spaces.
How can i solve this?

Also, before I submit it back using the $post, i want to return it as a number without spaces. I used the unmasked() method but it returns an object instead.

var creditCardValue = $(".cardField").unmask().mask("9999 9999 9999 9999");
        $(".cardField").val(creditCardValue);

so how i can do this correctly?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:11:15+00:00Added an answer on June 1, 2026 at 5:11 am

    I’ve checked the plugin I believe you are using – JQuery Mask Plugin. But as far as I can see, the unmask method simply removes the forced formatting and the text box value is retained as such. For example –

    Date – 12/12/2012 – with mask
    Date – 12/12/2012 – after unmasking

    So you’re stuck with having to remove the additional formatting yourself. You could consider, adding a custom validation for this particular field and then revert to a format of your desire on the server or before you post it to your server. That I think would be the only solution available to you now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input field with an id that is used as a button.
I have used an Input type=date field for accepting date value from the user
Ok I have an input tag. I used jquery input hints so it displays
I have a page that allows for used input, when the user inputs his/her
I have a registration form and used fieldset to order the input fields in
I used this code to print the current page: <form> <input type=button value=Print onClick=window.print();
I have a EditText box which is used to input names. Once the names
Today I've got an problem with an ObjectStream (Input and also Output). I used
In one of my projects I have used input[type=button] to apply a style to
I have a UITextField which I created programmatically. This text field is used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.