IE8 和 JQuery 的 trim() [英] IE8 and JQuery's trim()

查看:33
本文介绍了IE8 和 JQuery 的 trim()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我像这样使用trim():

I am making use of trim() like so:

if($('#group_field').val().trim()!=''){

其中 group_field 是文本类型的输入元素.这在 Firefox 中有效,但是当我在 IE8 上尝试时,它给了我这个错误:

Where group_field is an input element of type text. This works in Firefox but when I try it on IE8 it gives me this error:

Message: Object doesn't support this property or method

当我删除trim() 时,它在IE8 上运行良好.我认为我使用 trim() 的方式是正确的?

When I remove the trim(), it works fine on IE8. I thought the way I am using trim() is correct?

感谢大家的帮助

推荐答案

试试这个:

if($.trim($('#group_field').val()) != ''){

更多信息:

这篇关于IE8 和 JQuery 的 trim()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆