Drew2 Posted September 25, 2020 Report Share 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 Quote Link to comment Share on other sites More sharing options...
Drew2 Posted December 27, 2020 Author Report Share 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. Quote Link to comment Share on other sites More sharing options...
administrator Posted January 31, 2021 Report Share Posted January 31, 2021 Did you ever manage to get it working? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.