Uncaught TypeError: e.reportValidity[s] is not a function
at HTMLButtonElement.<anonymous>
at f (Line#57)
at HTMLDivElement.f.handle
at HTMLDivElement.dispatch
const legalityMethod = function () {
return 'reportValidity' in document.createElement('input') ? 'reportValidity' : 'checkValidity';
}();
第57行对应以下while循环;
function validate(form, field) {
while (m && m--) {
switch (fields[m]) {
case 'hello_world':
form.hello_world.setCustomValidity(config.language['amazing_world']);
break;
}
}
return form.reportValidity[legalityMethod](); //line#57
}
问题陈述:
我想知道这个错误背后的原因是什么,我如何才能摆脱这个错误。