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

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

问题描述

我正在使用trim(),如下所示:

I am making use of trim() like so:

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

其中 group_field 是text类型的输入元素。这适用于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()) != ''){

更多信息:

  • http://api.jquery.com/jQuery.trim/

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

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