【问题标题】:reactJs on IE9 throwing errorsreactJs 上 IE9 抛出错误
【发布时间】:2016-05-13 10:18:07
【问题描述】:

我设法使用 reactJs 创建了一个登录表单: https://jsbin.com/qehifu/1

我在IE9 上收到此错误(在 Chrome 上运行良好):

SCRIPT5007:无法获取属性值“删除”:空对象或未定义

SCRIPT5007:无法获取属性值“add”:空对象或未定义

    isValid: function (input) {
    //check required field
    if (input.getAttribute('required') != null && input.value ==="") {
        input.classList.add('error'); //add class error
        input.nextSibling.textContent = this.props.messageEmail; // show error message
        return false;
    }
    else {
        input.classList.remove('error');
        input.nextSibling.textContent = "";

        //rest of the file...

    }

你们能帮忙吗?谢谢

【问题讨论】:

  • React 应该或多或少地与 ie9 一起工作。您可以通过 console.log input.classList 和 input 获得更多见解吗?

标签: javascript internet-explorer reactjs


【解决方案1】:

ClassList API 仅在 V10 中引入 IE。

你可以考虑使用 polyfill,就像这里的那个 > https://github.com/eligrey/classList.js/

来源:https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#Browser_compatibility

【讨论】:

  • 已解决。感谢您的快速回复。 (来源+1)
猜你喜欢
  • 2011-12-12
  • 2012-01-24
  • 1970-01-01
  • 2016-10-31
  • 2022-01-11
  • 1970-01-01
  • 2018-11-16
  • 2019-04-19
  • 2020-07-17
相关资源
最近更新 更多