card
card copied to clipboard
Add a destroy method
There is a destroy method? How to use a modal, must destroy every hide the modal
Thanks for opening this issue — I think this is a good idea! Ideally, this method would:
- remove all event listeners
- remove the initialized property
- delete the card representation from inside the provided
container
I think this would be a good issue for a new contributor to tackle. If no one wants to, I will look into it in the next couple weeks. Thanks again!
Unfortunately, I don't possess the knowledge to do any of this or I would. Have you had a chance to work on this yet or is there a fast way to initialize to allow another card to be-entered? Thank you for your great work here, Jesse.
Any update on this? I'm using placeholders to show existing card info when showing edit_card route... The problem is when I go back to previous route and using the form in add_new_card route, the old placeholder is somehow displayed from previous edit_card route.
PS: I'm using React.
Together with this, it needs an 'update' method. This is helpful if the form is changed by script after the card has been initialized.
Hello, I needed to do something like this and I performed as follows, so far I have not detected any problems. I hope it helps. (using jQuery)
function resetCard(formSelector, containerSelector){
$(containerSelector).html('').removeAttr('data-jp-card-initialized').unwrap('form');
$(formSelector).removeData('card');
$.each( $(formSelector+ ' input'), function(key, value){
$(value).val('');
});
initCard(formSelector, containerSelector);
}
function initCard(formSelector, containerSelector)
{
$(formSelector).card({
container: containerSelector,
placeholders: {
number: '•••• •••• •••• ••••',
name: "FULL NAME",
expiry: '••/••••',
cvc: '•••'
},
messages: {
validDate: "validate",
monthYear: 'mm/yyyy',
},
masks: {
cardNumber: '•'
}
});
}
I have the same problem. But, i solved this way, every time of need clear, reuse the modal, i execute this lines:
$('div.jp-card')[0].className = 'jp-card jp-card-unknown';
$("div.jp-card-number").text("•••• •••• •••• ••••");
$("div.jp-card-name").text("FULL NAME");
$("div.jp-card-expiry").text("••/••••");
$("div.jp-card-cvc").text("•••");