简体   繁体   English

对象不支持此属性或方法-JQUERY-IE7

[英]Object doesn't support this property or method - JQUERY - IE7

I am using Jquery 1.5 to manipulate a form, I have been recieving the following error in IE 7 我正在使用Jquery 1.5操作表单,我在IE 7中收到以下错误

Object doesn't support this property or methood
Line: 10, Char: 0

I am using the following code: 我正在使用以下代码:

Line 8:   $(':input[name=firstname], :input[name=lastname], :input[name=middlename]').blur(function(){
Line 9:     var fullName = $(':input[name=firstname]').val().trim() + " " + $(':input[name=middlename]').val().trim() + " " + $(':input[name=lastname]').val().trim();
Line 10:    $(':input[name=sys_title], :input[name=displaytitle]').val(fullName);
Line: 11: });

Does anyone have any idea why it would fail in IE7 and not in FF? 有谁知道为什么它会在IE7中失败而不在FF中失败?

Thanks 谢谢

$.trim() doesn't work that way. $ .trim()不能那样工作。

$(':input[name=firstname]').val().trim() won't work. $(':input[name=firstname]').val().trim()无法正常工作。

$.trim($(':input[name=firstname]').val()) will work . $.trim($(':input[name=firstname]').val()) 将起作用

With IE7, I think blur event won't work, you'll have to handle something like : 使用IE7,我认为模糊事件将无法正常工作,您必须处理以下内容:

$('input[name=firstname]').bind('focusout', function(){
    alert('focusout');
});

You got more info in JQuery page : 您在JQuery页面中获得了更多信息:

The focusout event is sent to an element when it, or any element inside of it, loses focus. This is distinct from the blur event in that it supports detecting the loss of focus from parent elements (in other words, it supports event bubbling).

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM