Drew2 Posted September 25, 2020 Report Posted September 25, 2020 (edited) In the course, we are asked to copy and paste code that validates a US phone number. I was unable to find the exact page used in the course. However, I found another page with code that produces the same result. Here is the page: https://jqueryvalidation.org/phoneUS-method/ Here is the code that makes it all work (the bold portions are what I copy and pasted in): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Validation Example</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="validate.js"></script> <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ jQuery.validator.setDefaults({ debug: true, success: "valid" }); $( "#phone" ).validate({ rules: { field: { required: true, phoneUS: true } } }); $("#form").validate(); }); </script> Edited September 25, 2020 by Drew2
Drew2 Posted December 27, 2020 Author Report Posted December 27, 2020 Update: actually, this code doesn't quite do it. It does something else. So, I'd say the course could use some updating.
administrator Posted January 31, 2021 Report Posted January 31, 2021 Did you ever manage to get it working?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now