jQuery报错Uncaught TypeError: Cannot read property 'trim' of undefined

版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/u010882234/article/details/88135266

Uncaught TypeError: Cannot read property 'trim' of undefined

现象

页面一个小小改动后,jQuery报错,火狐正常,谷歌报错。

plugins.min.js?v=072418:8 Uncaught TypeError: Cannot read property 'trim' of undefined

在这里插入图片描述

分析

  1. 报错字面意思,使用trim()方法的元素是undefined,只要看下哪里报错,做了判断即可。
  2. 追踪了下,在一个min包里面,不好修改;而且指向具体代码是avalon.scan
  3. 看了下avalon绑定的表单,较上次只是某个input加了个disabled,去掉之后没问题了。
    在这里插入图片描述
    在这里插入图片描述

解决

加disabled是因为这个input不允许修改,既然报错就换吧,改为readonly,问题解决

<input name="organCode" type="text" class="form-control" placeholder="" ms-duplex="organCode" maxlength="20" disabled>

<input name="organCode" type="text" class="form-control" placeholder="" ms-duplex="organCode" maxlength="20" readonly>

猜你喜欢

转载自blog.csdn.net/u010882234/article/details/88135266