Skip to content

Instantly share code, notes, and snippets.

@huobazi
Forked from benmills/btcryptform.jquery.js
Created June 3, 2011 03:27
Show Gist options
  • Save huobazi/1005823 to your computer and use it in GitHub Desktop.
Save huobazi/1005823 to your computer and use it in GitHub Desktop.
var cryptForm = function(formId, toCryptNames) {
document.getElementById(formId).onsubmit = function() {
var clonedForm = this.cloneNode(true);
var els = clonedForm.getElementsByTagName("input");
for (i in els) if (toCryptNames.indexOf(els[i].name) > -1)
els[i].value = braintree.encrypt(els[i].value);
clonedForm.style.display = 'none';
document.body.appendChild(clonedForm);
clonedForm.submit();
return false;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment