Sam Jones Sam Jones - 7 months ago 55
Javascript Question

Disable number spacing in card number field on Braintree v3.2.0

example of current card number field

Hi all,

I've read the documentation but cant seem to find a simple way of disabling the space made after 4 digits are entered in the card number field. Is there a simple option I can turn to false or will I have to edit the JS?

On some older browser its causing credit card numbers to start jumbling when clients are typing their card number in. I know braintree only supports certain browsers but people are complaining and this seems to be the only issue.

If there's not a simple option to turn false i'll look at editing the js myself, just wanted to know if there is before I start doing that.

Answer

formatInput in the fields array with help you.

https://braintree.github.io/braintree-web/3.6.0/module-braintree-web_hosted-fields.html#~fieldOptions

Example:

number: { selector: "#card-number", placeholder: "Card Number", formatInput: false, },

RTFM