Skip to content

Instantly share code, notes, and snippets.

@walkirien
Last active February 22, 2022 02:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walkirien/91a6071a3664f6decff5973707196fc7 to your computer and use it in GitHub Desktop.
Save walkirien/91a6071a3664f6decff5973707196fc7 to your computer and use it in GitHub Desktop.
Phone number Normalization for Jumpseller Checkout
<!--Copy this code at the end of the Checkout Layout-->
<script>
$(document).ready(function(){
// Restrict to only numbers
$('#order_customer_phone').keypress(function(tecla){
if(tecla.charCode < 48 || tecla.charCode > 57) { return false;}
});
//Phone format
$("#order_customer_phone").attr("maxlength", "8").attr("minlength", "8"); // Change the number according to what you need
$("#order_customer_phone").attr("placeholder", ""); // you can add a format example
$("#order_customer_phone").attr("title", "You must enter at least 8 numbers");
})
</script>
@somoscircular
Copy link

cómo podemos hacer para que se "prellene" el campo con un 56 o +56?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment