我想在drupal7中以掩码格式显示电子邮件ID和手机号码?建议需要

时间:2016-04-19 09:58:48

标签: javascript jquery drupal drupal-7 drupal-6

实施例

raju327@gmail.com
9999888877

输出

rajuXXX@gmail.com 
999XXXX877

而且核心我想使用按钮点击OTP密码修复OTP功能只有客户应该更改用户名和密码。

1 个答案:

答案 0 :(得分:2)

检查工作示例,



$(document).ready(function () {
   MobEncrypt();
   EmailEncrypt()
});

function MobEncrypt() {
var value = '9999888877';
    // make a string with x-characters
    var x = new Array(value.length - 3).join('X');
    // join this string with the tail of the value, and replace it
    alert(x + value.substr(value.length - 3));
}

function EmailEncrypt() {
var value = 'raju327@gmail.com';
    // make a string with x-characters
    var x = new Array(value.length - 5).join('X');
    // join this string with the tail of the value, and replace it
    alert(x + value.substr(value.length - 5));
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
&#13;
&#13;
&#13;