Last active
February 27, 2022 13:04
-
-
Save vfontjr/c293d9467b3e0eada322a84dc407f709 to your computer and use it in GitHub Desktop.
Source code for https://formidable-masterminds.com/strip-non-numeric-characters-from-phone-number-with-jquery/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function($) { | |
"use strict"; | |
/* Format link phone number */ | |
$("#field_devdir_country_code, #field_devdir_primary_contact_phone").on("change", function() { | |
var link_number = $("#field_devdir_country_code").val() + $("#field_devdir_primary_contact_phone").val(); | |
$("#field_devdir_link_phone_number").val( link_number.replace(/\D/g,'') ); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment