Motti Horesh
Motti Horesh

Reputation: 798

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

Upvotes: 1

Views: 1597

Answers (2)

Michael Laffargue
Michael Laffargue

Reputation: 10304

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

Upvotes: 0

iambriansreed
iambriansreed

Reputation: 22241

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

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

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

Upvotes: 1

Related Questions