Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" language="JavaScript 1.2">
- <!--
- {literal}
- function cidev_check_phone(){
- var phone = $('#phone').val();
- phone = $.trim(phone);
- phone = phone.replace(/[^0-9\+]/g, '');
- phone = phone.replace(/[ ]+/gm, '');
- if (phone.length > 5){
- var prefix = phone[0]+phone[1]+phone[2];
- if (prefix == '370'){
- phone = '+' + phone;
- $('#phone').val(phone);
- }
- if (phone[0] != '+'){
- var new_phone = '+370';
- for (var i = 0; i < phone.length; i++){
- if (i != 0){
- new_phone = new_phone + phone[i];
- }
- }
- phone = new_phone;
- }
- }
- if (phone != $('#phone').val()){
- $('#phone').val(phone);
- }
- }
- $(document).ready(function() {
- $('#phone').focusout(function() {
- cidev_check_phone();
- });
- });
- {/literal}
- -->
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement