[笔记,表单,假资料]在空白表单中随机填入乱数资料方便测试

如标题,小弟在测试表单功能时会需要填入假资料来做测试,但栏位一多在填入就很麻烦讨厌...

印象中以前chrome有相似的套件,现在的套件试了几个不太会用XD
基本上都是固定上一次输入的内容....

不过我需要的是只要填入空白栏位就好,有资料的要跳过,那自己也来弄一个~~

$('input[value=""]').each(function() {    switch($(this).attr('type')) {         case 'text':             // 随机数字英文            $(this).val(Math.random().toString(Math.floor(Math.random()*34)+2).substring(2));            break;        case 'number':            //随机数字            $(this).val(Math.floor(Math.random()*100));            break;        case 'email':            //随机信箱            $(this).val(Math.random().toString(36).substring(2)+'@abc.com');            break;        default: break;    } });$('textarea').each(function() {    if($(this).val() == ''){        $(this).val(Math.random().toString(Math.floor(Math.random()*34)+2).substring(2));    }});

只要在该页面F12 贴上执行就ok

--
2019/06/26 加入textarea


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章