如标题,小弟在测试表单功能时会需要填入假资料来做测试,但栏位一多在填入就很麻烦讨厌...
印象中以前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