简体   繁体   中英

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

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?

Thanks

$.trim() doesn't work that way.

$(':input[name=firstname]').val().trim() won't work.

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

With IE7, I think blur event won't work, you'll have to handle something like :

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

You got more info in JQuery page :

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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