Created
June 10, 2020 09:44
-
-
Save rajeshsingh520/3a80a4c4e6fdec1959cc0567ef7e4dc8 to your computer and use it in GitHub Desktop.
10 digit phone number calidation for the enquiry cart plugin
This file contains hidden or 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
| <?php | |
| add_action('wp_enqueue_scripts','restrictPhoneNumber'); | |
| function restrictPhoneNumber(){ | |
| $js = ' | |
| jQuery(document).ready(function($){ | |
| jQuery("input[name=\'pi_phone\']").attr("data-rule-minlength","10"); | |
| jQuery("input[name=\'pi_phone\']").attr("data-rule-maxlength","10"); | |
| jQuery("input[name=\'pi_phone\']").attr("data-msg-minlength","Phone number should be of 10 digits"); | |
| jQuery("input[name=\'pi_phone\']").attr("data-msg-maxlength","Phone number should be of 10 digits"); | |
| }); | |
| '; | |
| wp_add_inline_script('jquery', $js, 'after'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment