frankstuner
frankstuner

Reputation: 4500

IE 7/8 Issue - Unable to get value of the property 'id': object is null or undefined

I've made an ajax search form that brings up results onkeyup, that works well.

To remove the results if someone clicks anywhere on the page outside the results list i've used currentTarget on a transparent fullscreen div at the top of the page to clear the results.

It works perfectly in ff, ie9, chrome, safari & opera. But when trying it in ie 7 and ie 8 it shows the results but won't remove them. The console is returning this:

SCRIPT5007: Unable to get value of the property 'id': object is null or undefined

Any ideas what this could be. I've search for bugs online but it didn't bring anything I could work out.

Upvotes: 3

Views: 3244

Answers (2)

user3524931
user3524931

Reputation: 11

There are trailing comma's after the last items of arrays/objects, remove them, IE doesn't like trailing commas in arrays/objects. for example

{ "date": "2014-08-20 14:40:30", "title": "event 1event", "description": "af sdfa sdfasd ..." }, { "date": "2014-06-30 00:00:00", "title": "event 2", "description": "a sdfa" }, { "date": "2014-06-29 00:00:00", "title": "event 3" }, 

remove last comma as given below

{ "date": "2014-08-20 14:40:30", "title": "event 1event", "description": "af sdfa sdfasd ..." }, { "date": "2014-06-30 00:00:00", "title": "event 2", "description": "a sdfa" }, { "date": "2014-06-29 00:00:00", "title": "event 3" }

Cheers :)

Upvotes: 0

RightSaidFred
RightSaidFred

Reputation: 11327

event.currentTarget isn't available in IE8 and lower.

Depending on how your handler is bound, you may be able to use this in place of currentTarget.

Upvotes: 1

Related Questions